@cosmicdrift/kumiko-samples 0.412.0 → 0.413.1

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 (135) 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/api-docs/anchors.ts +1 -1
  5. package/packages/bundled-features/src/auth-email-password/boot-rules.ts +9 -0
  6. package/packages/bundled-features/src/auth-email-password/feature.ts +6 -19
  7. package/packages/bundled-features/src/auth-email-password/validate-options.ts +20 -0
  8. package/packages/bundled-features/src/billing-foundation/boot-rules.ts +26 -0
  9. package/packages/bundled-features/src/billing-foundation/validate-options.ts +59 -46
  10. package/packages/bundled-features/src/cap-overview/boot-rules.ts +14 -0
  11. package/packages/bundled-features/src/cap-overview/feature.ts +12 -5
  12. package/packages/bundled-features/src/data-retention/changes.json +6 -0
  13. package/packages/bundled-features/src/data-retention/feature.ts +3 -2
  14. package/packages/bundled-features/src/documents/boot-rules.ts +14 -0
  15. package/packages/bundled-features/src/documents/feature.ts +8 -4
  16. package/packages/bundled-features/src/file-derivatives/boot-rules.ts +9 -0
  17. package/packages/bundled-features/src/file-derivatives/feature.ts +6 -3
  18. package/packages/bundled-features/src/folders/boot-rules.ts +9 -0
  19. package/packages/bundled-features/src/folders/feature.ts +6 -3
  20. package/packages/bundled-features/src/helpdesk/boot-rules.ts +9 -0
  21. package/packages/bundled-features/src/{contact → helpdesk}/challenge.ts +2 -2
  22. package/packages/bundled-features/src/{contact → helpdesk}/changes.json +18 -0
  23. package/packages/bundled-features/src/{contact/client/contact-client-source.ts → helpdesk/client/helpdesk-client-source.ts} +4 -4
  24. package/packages/bundled-features/src/helpdesk/client/helpdesk-website-client.ts +29 -0
  25. package/packages/bundled-features/src/helpdesk/client/index.ts +9 -0
  26. package/packages/bundled-features/src/{contact → helpdesk}/entity.ts +35 -31
  27. package/packages/bundled-features/src/{contact → helpdesk}/feature.ts +56 -52
  28. package/packages/bundled-features/src/{contact → helpdesk}/handlers/attempts.ts +3 -3
  29. package/packages/bundled-features/src/{contact → helpdesk}/handlers/challenge.query.ts +10 -10
  30. package/packages/bundled-features/src/{contact → helpdesk}/handlers/forward-request.write.ts +25 -23
  31. package/packages/bundled-features/src/{contact → helpdesk}/handlers/mark-done.write.ts +11 -11
  32. package/packages/bundled-features/src/{contact → helpdesk}/handlers/notify-reporter-in-app.write.ts +14 -14
  33. package/packages/bundled-features/src/{contact → helpdesk}/handlers/open-count.query.ts +4 -4
  34. package/packages/bundled-features/src/{contact → helpdesk}/handlers/open-count.ts +2 -2
  35. package/packages/bundled-features/src/{contact → helpdesk}/handlers/replies.query.ts +6 -6
  36. package/packages/bundled-features/src/{contact → helpdesk}/handlers/reply.write.ts +30 -30
  37. package/packages/bundled-features/src/{contact → helpdesk}/handlers/report.write.ts +29 -29
  38. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-delivery.query.ts +40 -40
  39. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-detail.query.ts +15 -15
  40. package/packages/bundled-features/src/{contact → helpdesk}/handlers/request-list.query.ts +2 -2
  41. package/packages/bundled-features/src/{contact → helpdesk}/handlers/send-reply-mail.write.ts +24 -24
  42. package/packages/bundled-features/src/{contact → helpdesk}/handlers/send-test.write.ts +18 -14
  43. package/packages/bundled-features/src/{contact → helpdesk}/handlers/submit.write.ts +32 -31
  44. package/packages/bundled-features/src/{contact → helpdesk}/handlers/take-over-uploads.ts +5 -5
  45. package/packages/bundled-features/src/{contact → helpdesk}/i18n.ts +78 -75
  46. package/packages/bundled-features/src/helpdesk/index.ts +29 -0
  47. package/packages/bundled-features/src/{contact → helpdesk}/lib.ts +32 -28
  48. package/packages/bundled-features/src/{contact → helpdesk}/mail.ts +56 -56
  49. package/packages/bundled-features/src/{contact → helpdesk}/options.ts +18 -16
  50. package/packages/bundled-features/src/helpdesk/panels.ts +28 -0
  51. package/packages/bundled-features/src/{contact → helpdesk}/payloads.ts +33 -33
  52. package/packages/bundled-features/src/{contact → helpdesk}/screens.ts +104 -104
  53. package/packages/bundled-features/src/{contact → helpdesk}/subject.ts +3 -3
  54. package/packages/bundled-features/src/{contact → helpdesk}/user-data-hooks.ts +17 -17
  55. package/packages/bundled-features/src/helpdesk/web/constants.ts +160 -0
  56. package/packages/bundled-features/src/helpdesk/web/index.ts +29 -0
  57. package/packages/bundled-features/src/host-routing/boot-rules.ts +27 -0
  58. package/packages/bundled-features/src/host-routing/validate-options.ts +36 -27
  59. package/packages/bundled-features/src/jobs/boot-rules.ts +9 -0
  60. package/packages/bundled-features/src/jobs/feature.ts +9 -4
  61. package/packages/bundled-features/src/legal-pages/boot-rules.ts +19 -0
  62. package/packages/bundled-features/src/legal-pages/feature.ts +6 -3
  63. package/packages/bundled-features/src/legal-pages/lib/validate-routes.ts +11 -5
  64. package/packages/bundled-features/src/metrics/boot-rules.ts +15 -0
  65. package/packages/bundled-features/src/metrics/validate.ts +8 -2
  66. package/packages/bundled-features/src/notes-history/boot-rules.ts +9 -0
  67. package/packages/bundled-features/src/notes-history/feature.ts +6 -3
  68. package/packages/bundled-features/src/personal-access-tokens/boot-rules.ts +9 -0
  69. package/packages/bundled-features/src/personal-access-tokens/scope-events-check.ts +6 -3
  70. package/packages/bundled-features/src/presence/boot-rules.ts +9 -0
  71. package/packages/bundled-features/src/presence/options.ts +5 -1
  72. package/packages/bundled-features/src/readiness/boot-rules.ts +14 -0
  73. package/packages/bundled-features/src/readiness/probe-boot-check.ts +8 -6
  74. package/packages/bundled-features/src/shared/assert-no-where-rule-in-ownership-write.ts +6 -4
  75. package/packages/bundled-features/src/shared/boot-rules.ts +9 -0
  76. package/packages/bundled-features/src/subscription-mollie/boot-rules.ts +19 -0
  77. package/packages/bundled-features/src/subscription-mollie/feature.ts +18 -10
  78. package/packages/bundled-features/src/tags/boot-rules.ts +9 -0
  79. package/packages/bundled-features/src/tags/feature.ts +6 -3
  80. package/packages/bundled-features/src/template-resolver/boot-rules.ts +19 -0
  81. package/packages/bundled-features/src/template-resolver/feature.ts +14 -10
  82. package/packages/bundled-features/src/tenant/boot-rules.ts +9 -0
  83. package/packages/bundled-features/src/tenant/feature.ts +5 -3
  84. package/samples/apps/marketing-demo/README.md +1 -1
  85. package/samples/apps/marketing-demo/playwright.config.ts +1 -1
  86. package/samples/apps/marketing-demo/src/app/client.tsx +3 -3
  87. package/samples/apps/marketing-demo/src/app/seed-data.ts +1 -1
  88. package/samples/apps/marketing-demo/src/app/seed.ts +4 -4
  89. package/samples/apps/marketing-demo/src/app/server.ts +3 -3
  90. package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/feature.ts +15 -12
  91. package/samples/apps/marketing-demo/src/features/ticketing/i18n.ts +100 -0
  92. package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/schema/ticket.ts +4 -4
  93. package/samples/apps/marketing-demo/src/features/ticketing/web/index.ts +7 -0
  94. package/samples/apps/use-all-bundled/feature-manifest.json +67 -67
  95. package/samples/apps/use-all-bundled/kumiko/migrations/0064_helpdesk-rename.rebuild.json +4 -0
  96. package/samples/apps/use-all-bundled/package.json +1 -1
  97. package/samples/apps/use-all-bundled/src/app/client.tsx +1 -1
  98. package/samples/apps/use-all-bundled/src/app/screens-feature.ts +10 -10
  99. package/samples/apps/use-all-bundled/src/run-config.ts +6 -6
  100. package/samples/recipes/api-docs/README.md +3 -3
  101. package/samples/recipes/api-docs/api-docs/de/events.md +14 -14
  102. package/samples/recipes/api-docs/api-docs/de/overview.md +3 -3
  103. package/samples/recipes/api-docs/api-docs/de/reference/tickets.md +10 -10
  104. package/samples/recipes/api-docs/api-docs/de/tokens.md +4 -4
  105. package/samples/recipes/api-docs/api-docs/en/events.md +14 -14
  106. package/samples/recipes/api-docs/api-docs/en/overview.md +3 -3
  107. package/samples/recipes/api-docs/api-docs/en/reference/tickets.md +10 -10
  108. package/samples/recipes/api-docs/api-docs/en/tokens.md +4 -4
  109. package/samples/recipes/api-docs/api-docs/index.json +22 -22
  110. package/samples/recipes/api-docs/api-docs/openapi.json +67 -67
  111. package/samples/recipes/api-docs/api-examples/ticket-close.json +1 -1
  112. package/samples/recipes/api-docs/api-examples/ticket-create.json +1 -1
  113. package/samples/recipes/api-docs/api-examples/ticket-detail.json +1 -1
  114. package/samples/recipes/api-docs/api-examples/ticket-list.json +1 -1
  115. package/samples/recipes/api-docs/api-examples/ticket-update.json +1 -1
  116. package/samples/recipes/api-docs/api-examples/webhooks/ticket-closed.json +1 -1
  117. package/samples/recipes/api-docs/kumiko.config.ts +4 -4
  118. package/samples/recipes/api-docs/src/feature.ts +44 -44
  119. package/samples/recipes/golden-path/src/feature.ts +1 -1
  120. package/samples/recipes/helpdesk/README.md +56 -0
  121. package/samples/recipes/{contact → helpdesk}/package.json +2 -2
  122. package/samples/recipes/{contact → helpdesk}/src/feature.ts +11 -8
  123. package/packages/bundled-features/src/contact/client/contact-website-client.ts +0 -29
  124. package/packages/bundled-features/src/contact/client/index.ts +0 -9
  125. package/packages/bundled-features/src/contact/index.ts +0 -29
  126. package/packages/bundled-features/src/contact/panels.ts +0 -28
  127. package/packages/bundled-features/src/contact/web/constants.ts +0 -160
  128. package/packages/bundled-features/src/contact/web/index.ts +0 -29
  129. package/samples/apps/marketing-demo/src/features/helpdesk/i18n.ts +0 -100
  130. package/samples/apps/marketing-demo/src/features/helpdesk/web/index.ts +0 -7
  131. package/samples/recipes/contact/README.md +0 -52
  132. /package/packages/bundled-features/src/{contact → helpdesk}/handlers/access.ts +0 -0
  133. /package/packages/bundled-features/src/{contact → helpdesk}/pow.ts +0 -0
  134. /package/packages/bundled-features/src/{contact → helpdesk}/user-agent.ts +0 -0
  135. /package/samples/apps/marketing-demo/src/features/{helpdesk → ticketing}/schema/index.ts +0 -0
@@ -1,7 +1,9 @@
1
1
  import {
2
+ bootRuleError,
2
3
  createWebhookContractResolver,
3
4
  type FeatureDefinition,
4
5
  } from "@cosmicdrift/kumiko-framework/engine";
6
+ import { PERSONAL_ACCESS_TOKENS_BOOT_RULES } from "./boot-rules.ts";
5
7
  import { PAT_FEATURE } from "./web/constants.ts";
6
8
  import type { PatScopeConfig } from "./web/scopes.ts";
7
9
 
@@ -18,11 +20,12 @@ export function validateScopeEventContracts(
18
20
  for (const [domain, def] of Object.entries(scopes)) {
19
21
  for (const qn of def.events ?? []) {
20
22
  if (resolver.get(qn)) continue;
21
- throw new Error(
22
- `[${PAT_FEATURE}] scope "${domain}" lists event "${qn}" without a public contract. ` +
23
+ throw bootRuleError(PERSONAL_ACCESS_TOKENS_BOOT_RULES.scopeEventWithoutContract, {
24
+ message:
25
+ `[${PAT_FEATURE}] scope "${domain}" lists event "${qn}" without a public contract. ` +
23
26
  "Declare it with r.defineWebhookEvent(...), or set webhookEvents: true on the entity to release its <entity>.created/.updated/.deleted events " +
24
27
  `(entity "${entityNameOf(qn)}" has no such opt-in); internal r.defineEvent events are never released.`,
25
- );
28
+ });
26
29
  }
27
30
  }
28
31
  }
@@ -0,0 +1,9 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const PRESENCE_BOOT_RULES = {
4
+ invalidTtlSeconds: {
5
+ id: "presence/invalid-ttl-seconds",
6
+ summary: "The presence ttlSeconds option is a positive number.",
7
+ fix: "Pass a positive ttlSeconds.",
8
+ },
9
+ } as const satisfies BootRuleTable;
@@ -1,3 +1,5 @@
1
+ import { bootRuleError } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { PRESENCE_BOOT_RULES } from "./boot-rules.ts";
1
3
  export const PRESENCE_DEFAULT_ROLES: readonly string[] = ["TenantAdmin", "TenantMember"];
2
4
  export const PRESENCE_DEFAULT_TTL_SECONDS = 45;
3
5
 
@@ -20,7 +22,9 @@ export type PresenceSettings = {
20
22
  export function resolvePresenceSettings(options: PresenceOptions): PresenceSettings {
21
23
  const ttlSeconds = options.ttlSeconds ?? PRESENCE_DEFAULT_TTL_SECONDS;
22
24
  if (!Number.isFinite(ttlSeconds) || ttlSeconds <= 0) {
23
- throw new Error(`presence: ttlSeconds must be a positive number, got ${ttlSeconds}`);
25
+ throw bootRuleError(PRESENCE_BOOT_RULES.invalidTtlSeconds, {
26
+ message: `presence: ttlSeconds must be a positive number, got ${ttlSeconds}`,
27
+ });
24
28
  }
25
29
  return {
26
30
  entities: new Set(options.entities ?? []),
@@ -0,0 +1,14 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const READINESS_BOOT_RULES = {
4
+ probeTranslationMissing: {
5
+ id: "readiness/probe-translation-missing",
6
+ summary: "Probe area and label keys are defined by a mounted feature.",
7
+ fix: "Add the key via r.translations(...).",
8
+ },
9
+ probeFixScreenUnknown: {
10
+ id: "readiness/probe-fix-screen-unknown",
11
+ summary: "A probe fixScreen names a screen of a mounted feature.",
12
+ fix: "Use a <feature>:screen:<id> qualified name of a mounted screen.",
13
+ },
14
+ } as const satisfies BootRuleTable;
@@ -1,9 +1,11 @@
1
1
  import {
2
+ bootRuleError,
2
3
  buildConfigFeatureSchema,
3
4
  createRegistry,
4
5
  type FeatureDefinition,
5
6
  SETTINGS_HUB_FEATURE,
6
7
  } from "@cosmicdrift/kumiko-framework/engine";
8
+ import { READINESS_BOOT_RULES } from "./boot-rules.ts";
7
9
 
8
10
  // Settings screens come from config keys at schema build, not from r.screen, yet a probe may
9
11
  // link a failed row to one (mail sending lives on config:screen:mail-foundation-tenant).
@@ -38,15 +40,15 @@ export function validateProbeTranslations(features: readonly FeatureDefinition[]
38
40
  ["label", probe.label],
39
41
  ] as const) {
40
42
  if (!defined.has(key)) {
41
- throw new Error(
42
- `Probe "${probe.qualifiedName}": ${field} translation key "${key}" is not defined by any mounted feature. Add it via r.translations(...).`,
43
- );
43
+ throw bootRuleError(READINESS_BOOT_RULES.probeTranslationMissing, {
44
+ message: `Probe "${probe.qualifiedName}": ${field} translation key "${key}" is not defined by any mounted feature. Add it via r.translations(...).`,
45
+ });
44
46
  }
45
47
  }
46
48
  if (probe.fixScreen !== undefined && !screenQns.has(probe.fixScreen)) {
47
- throw new Error(
48
- `Probe "${probe.qualifiedName}": fixScreen "${probe.fixScreen}" is not a screen of any mounted feature. Use a "<feature>:screen:<id>" QN.`,
49
- );
49
+ throw bootRuleError(READINESS_BOOT_RULES.probeFixScreenUnknown, {
50
+ message: `Probe "${probe.qualifiedName}": fixScreen "${probe.fixScreen}" is not a screen of any mounted feature. Use a "<feature>:screen:<id>" QN.`,
51
+ });
50
52
  }
51
53
  }
52
54
  }
@@ -1,4 +1,5 @@
1
- import type { OwnershipMap } from "@cosmicdrift/kumiko-framework/engine";
1
+ import { bootRuleError, type OwnershipMap } from "@cosmicdrift/kumiko-framework/engine";
2
+ import { SHARED_BOOT_RULES } from "./boot-rules.ts";
2
3
 
3
4
  // Boot validation rejects `{ kind: "where" }` in access.write too;
4
5
  // failing at factory time names the option instead of an entity scope.
@@ -13,13 +14,14 @@ export function assertNoWhereRuleInOwnershipWrite(
13
14
  );
14
15
  // skip: no where-rule present, the option is valid
15
16
  if (!hasWhereRule) return;
16
- throw new Error(
17
- `${factoryName}({ ownership }): ownership.write must not contain a ` +
17
+ throw bootRuleError(SHARED_BOOT_RULES.whereRuleInOwnershipWrite, {
18
+ message:
19
+ `${factoryName}({ ownership }): ownership.write must not contain a ` +
18
20
  '`{ kind: "where" }` rule — where-rules are evaluated only at the SQL ' +
19
21
  "layer (the read path, via buildOwnershipClause). Write paths that " +
20
22
  "consult access.write (userCanCreateFieldRow/userCanWriteFieldRow) can't " +
21
23
  "evaluate them, so such a rule can only ever deny — boot validation " +
22
24
  "rejects it too (fw#2626). Use a `from()` rule for ownership.write, or " +
23
25
  "leave it unset.",
24
- );
26
+ });
25
27
  }
@@ -0,0 +1,9 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const SHARED_BOOT_RULES = {
4
+ whereRuleInOwnershipWrite: {
5
+ id: "shared/where-rule-in-ownership-write",
6
+ summary: "ownership.write of a bundled-feature factory contains no where rule.",
7
+ fix: "Drop the where rule from ownership.write; it only applies on the read path.",
8
+ },
9
+ } as const satisfies BootRuleTable;
@@ -0,0 +1,19 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const SUBSCRIPTION_MOLLIE_BOOT_RULES = {
4
+ emptyApiKey: {
5
+ id: "subscription-mollie/empty-api-key",
6
+ summary: "The Mollie provider receives a non-empty apiKey.",
7
+ fix: "Set MOLLIE_API_KEY before mounting.",
8
+ },
9
+ emptyWebhookUrl: {
10
+ id: "subscription-mollie/empty-webhook-url",
11
+ summary: "The Mollie provider receives a non-empty webhookUrl.",
12
+ fix: "Pass the foundation webhook URL Mollie sends events to.",
13
+ },
14
+ priceMapDrift: {
15
+ id: "subscription-mollie/price-map-drift",
16
+ summary: "priceToTier and priceToConfig declare the same price ids.",
17
+ fix: "Make both maps list the same price ids.",
18
+ },
19
+ } as const satisfies BootRuleTable;
@@ -40,9 +40,14 @@
40
40
  // ];
41
41
 
42
42
  import type { SubscriptionProviderPlugin } from "@cosmicdrift/kumiko-bundled-features/billing-foundation";
43
- import { defineFeature, type FeatureDefinition } from "@cosmicdrift/kumiko-framework/engine";
43
+ import {
44
+ bootRuleError,
45
+ defineFeature,
46
+ type FeatureDefinition,
47
+ } from "@cosmicdrift/kumiko-framework/engine";
44
48
  import { createMollieClient } from "@mollie/api-client";
45
49
  import * as z from "zod";
50
+ import { SUBSCRIPTION_MOLLIE_BOOT_RULES } from "./boot-rules.ts";
46
51
  import { MOLLIE_PROVIDER_NAME, SUBSCRIPTION_MOLLIE_FEATURE } from "./constants.ts";
47
52
  import { createMollieCheckoutSession, type MolliePriceConfig } from "./plugin-methods.ts";
48
53
  import { type MollieClientShape, verifyAndParseMollieWebhook } from "./verify-webhook.ts";
@@ -91,14 +96,16 @@ export function createSubscriptionMollieFeature(
91
96
  options: SubscriptionMollieOptions,
92
97
  ): FeatureDefinition {
93
98
  if (options.apiKey.length === 0) {
94
- throw new Error(
95
- "subscription-mollie: apiKey is empty. Set MOLLIE_API_KEY (or system-config) before mounting.",
96
- );
99
+ throw bootRuleError(SUBSCRIPTION_MOLLIE_BOOT_RULES.emptyApiKey, {
100
+ message:
101
+ "subscription-mollie: apiKey is empty. Set MOLLIE_API_KEY (or system-config) before mounting.",
102
+ });
97
103
  }
98
104
  if (options.webhookUrl.length === 0) {
99
- throw new Error(
100
- "subscription-mollie: webhookUrl is empty. Set the foundation-webhook-URL where Mollie sends events.",
101
- );
105
+ throw bootRuleError(SUBSCRIPTION_MOLLIE_BOOT_RULES.emptyWebhookUrl, {
106
+ message:
107
+ "subscription-mollie: webhookUrl is empty. Set the foundation-webhook-URL where Mollie sends events.",
108
+ });
102
109
  }
103
110
 
104
111
  // Drift guard: priceToTier and priceToConfig must have identical keys;
@@ -108,11 +115,12 @@ export function createSubscriptionMollieFeature(
108
115
  const missingInConfig = [...tierKeys].filter((k) => !configKeys.has(k));
109
116
  const missingInTier = [...configKeys].filter((k) => !tierKeys.has(k));
110
117
  if (missingInConfig.length > 0 || missingInTier.length > 0) {
111
- throw new Error(
112
- `subscription-mollie: priceToTier ↔ priceToConfig drift — ` +
118
+ throw bootRuleError(SUBSCRIPTION_MOLLIE_BOOT_RULES.priceMapDrift, {
119
+ message:
120
+ `subscription-mollie: priceToTier ↔ priceToConfig drift — ` +
113
121
  `priceIds in tier but missing config: [${missingInConfig.join(", ")}]; ` +
114
122
  `priceIds in config but missing tier: [${missingInTier.join(", ")}]`,
115
- );
123
+ });
116
124
  }
117
125
 
118
126
  const client = createMollieClient({ apiKey: options.apiKey });
@@ -0,0 +1,9 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const TAGS_BOOT_RULES = {
4
+ emptyParentsAllowlist: {
5
+ id: "tags/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;
@@ -20,6 +20,7 @@
20
20
 
21
21
  import {
22
22
  type AccessRule,
23
+ bootRuleError,
23
24
  defineEntityDetailHandler,
24
25
  defineEntityListHandler,
25
26
  defineEntityUpdateHandler,
@@ -28,6 +29,7 @@ import {
28
29
  type FeatureRegistrar,
29
30
  } from "@cosmicdrift/kumiko-framework/engine";
30
31
  import { assertNoWhereRuleInOwnershipWrite, resolveFeatureAccess } from "../shared/index.ts";
32
+ import { TAGS_BOOT_RULES } from "./boot-rules.ts";
31
33
  import { createTagAssignmentEntity, tagEntity } from "./entity.ts";
32
34
  import { createTagAssignmentExecutor } from "./executor.ts";
33
35
  import { createAssignTagHandler } from "./handlers/assign-tag.write.ts";
@@ -189,12 +191,13 @@ export function createTagsFeature(opts: TagsFeatureOptions = {}): typeof default
189
191
  return defaultTagsFeature;
190
192
  }
191
193
  if (opts.parents !== undefined && opts.parents.length === 0) {
192
- throw new Error(
193
- "createTagsFeature({ parents }): parents must not be an empty array — " +
194
+ throw bootRuleError(TAGS_BOOT_RULES.emptyParentsAllowlist, {
195
+ message:
196
+ "createTagsFeature({ parents }): parents must not be an empty array — " +
194
197
  "an empty allowlist rejects every assign-tag call and hides every " +
195
198
  "assignment row. Omit `parents` to keep every registered entity " +
196
199
  "admissible as a host instead.",
197
- );
200
+ });
198
201
  }
199
202
  assertNoWhereRuleInOwnershipWrite("createTagsFeature", opts.ownership?.write);
200
203
  const access = resolveFeatureAccess(opts, DEFAULT_TAG_ACCESS);
@@ -0,0 +1,19 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const TEMPLATE_RESOLVER_BOOT_RULES = {
4
+ collectionRefusedKind: {
5
+ id: "template-resolver/collection-refused-kind",
6
+ summary: "Collections only use kinds that collections may write.",
7
+ fix: "Pick an allowed collection kind.",
8
+ },
9
+ tenantEditableDuplicate: {
10
+ id: "template-resolver/tenant-editable-duplicate",
11
+ summary: "tenantEditable lists each kind and slug once.",
12
+ fix: "Remove the duplicate entry.",
13
+ },
14
+ tenantEditableInvalidEntry: {
15
+ id: "template-resolver/tenant-editable-invalid-entry",
16
+ summary: "Each tenantEditable entry has a non-empty slug and at least one access role.",
17
+ fix: "Give the entry a slug and roles.",
18
+ },
19
+ } as const satisfies BootRuleTable;
@@ -1,9 +1,11 @@
1
1
  import {
2
+ bootRuleError,
2
3
  type ContentCollectionDefinition,
3
4
  createSystemConfig,
4
5
  defineFeature,
5
6
  type TreeAction,
6
7
  } from "@cosmicdrift/kumiko-framework/engine";
8
+ import { TEMPLATE_RESOLVER_BOOT_RULES } from "./boot-rules.ts";
7
9
  import { bySlugQuery } from "./handlers/by-slug.query.ts";
8
10
  import { byTenantQuery } from "./handlers/by-tenant.query.ts";
9
11
  import { makeCollectionItemQuery } from "./handlers/collection-item.query.ts";
@@ -82,9 +84,9 @@ export type TemplateResolverOptions = {
82
84
  function assertCollectionKindsAllowed(collections: readonly ContentCollectionDefinition[]): void {
83
85
  for (const collection of collections) {
84
86
  if (isCollectionRefusedKind(collection.kind)) {
85
- throw new Error(
86
- `template-resolver: collection "${collection.id}" uses kind "${collection.kind}", which collections may not write`,
87
- );
87
+ throw bootRuleError(TEMPLATE_RESOLVER_BOOT_RULES.collectionRefusedKind, {
88
+ message: `template-resolver: collection "${collection.id}" uses kind "${collection.kind}", which collections may not write`,
89
+ });
88
90
  }
89
91
  }
90
92
  }
@@ -94,18 +96,20 @@ function assertTenantEditableValid(entries: readonly TenantEditableTemplate[]):
94
96
  for (const entry of entries) {
95
97
  const key = `${entry.kind}/${entry.slug}`;
96
98
  if (seen.has(key)) {
97
- throw new Error(`template-resolver: tenantEditable lists "${key}" twice`);
99
+ throw bootRuleError(TEMPLATE_RESOLVER_BOOT_RULES.tenantEditableDuplicate, {
100
+ message: `template-resolver: tenantEditable lists "${key}" twice`,
101
+ });
98
102
  }
99
103
  seen.add(key);
100
104
  if (entry.slug.trim() === "") {
101
- throw new Error(
102
- `template-resolver: tenantEditable entry of kind "${entry.kind}" has an empty slug`,
103
- );
105
+ throw bootRuleError(TEMPLATE_RESOLVER_BOOT_RULES.tenantEditableInvalidEntry, {
106
+ message: `template-resolver: tenantEditable entry of kind "${entry.kind}" has an empty slug`,
107
+ });
104
108
  }
105
109
  if (entry.access.roles.length === 0) {
106
- throw new Error(
107
- `template-resolver: tenantEditable entry "${entry.kind}/${entry.slug}" has no roles in access`,
108
- );
110
+ throw bootRuleError(TEMPLATE_RESOLVER_BOOT_RULES.tenantEditableInvalidEntry, {
111
+ message: `template-resolver: tenantEditable entry "${entry.kind}/${entry.slug}" has no roles in access`,
112
+ });
109
113
  }
110
114
  }
111
115
  }
@@ -0,0 +1,9 @@
1
+ import type { BootRuleTable } from "@cosmicdrift/kumiko-framework/engine";
2
+
3
+ export const TENANT_BOOT_RULES = {
4
+ assignableRoleMissingFromScreens: {
5
+ id: "tenant/assignable-role-missing-from-screens",
6
+ summary: "Every assignable app role is present in the tenant screens' options.",
7
+ fix: "Pass assignableAppRoles: collectAssignableAppRoles(appFeatures) to createTenantFeature.",
8
+ },
9
+ } as const satisfies BootRuleTable;
@@ -2,6 +2,7 @@ import {
2
2
  type AssignableAppRoles,
3
3
  access,
4
4
  assignableAppRolesFromUsages,
5
+ bootRuleError,
5
6
  createSystemConfig,
6
7
  createTenantConfig,
7
8
  defineEntityDetailHandler,
@@ -12,6 +13,7 @@ import {
12
13
  type FeatureDefinition,
13
14
  i18nKey,
14
15
  } from "@cosmicdrift/kumiko-framework/engine";
16
+ import { TENANT_BOOT_RULES } from "./boot-rules.ts";
15
17
  import { activeTenantIdsQuery } from "./handlers/active-tenant-ids.query.ts";
16
18
  import { addMemberWrite } from "./handlers/add-member.write.ts";
17
19
  import { cancelInvitationWrite } from "./handlers/cancel-invitation.write.ts";
@@ -88,9 +90,9 @@ export function createTenantFeature(options?: TenantFeatureOptions): FeatureDefi
88
90
  r.bootCheck(({ features }) => {
89
91
  for (const [role, assignableFrom] of collectAssignableAppRoles(features)) {
90
92
  if (options?.assignableAppRoles?.get(role) === assignableFrom) continue;
91
- throw new Error(
92
- `[tenant] assignable app role "${role}" (assignableFrom "${assignableFrom}") is declared but missing from the tenant screens' options; pass assignableAppRoles: collectAssignableAppRoles(appFeatures) to createTenantFeature.`,
93
- );
93
+ throw bootRuleError(TENANT_BOOT_RULES.assignableRoleMissingFromScreens, {
94
+ message: `[tenant] assignable app role "${role}" (assignableFrom "${assignableFrom}") is declared but missing from the tenant screens' options; pass assignableAppRoles: collectAssignableAppRoles(appFeatures) to createTenantFeature.`,
95
+ });
94
96
  }
95
97
  });
96
98
  r.entity({ name: "tenant", ...tenantEntity });
@@ -2,7 +2,7 @@
2
2
 
3
3
  Sample app that produces marketing screenshots for
4
4
  [kumiko.rocks](https://kumiko.rocks). Two small internal tools (asset tracker
5
- - helpdesk) on a single Kumiko instance — a DACH-persona proof that the
5
+ - ticketing) on a single Kumiko instance — a DACH-persona proof that the
6
6
  same framework stack covers two tools without separate codebases.
7
7
 
8
8
  **No auth** — like the showcase, in auto-mint-JWT mode. Straight to
@@ -1,6 +1,6 @@
1
1
  // @runtime test
2
2
  // Playwright config for the marketing demo. Generates screenshots from the
3
- // actually rendered pages (asset tracker + helpdesk) into the configured
3
+ // actually rendered pages (asset tracker + ticketing) into the configured
4
4
  // screenshot directory.
5
5
 
6
6
  import { defineAppE2eConfig, PLAYWRIGHT_DEMO_ENV } from "@cosmicdrift/kumiko-testing/e2e";
@@ -1,13 +1,13 @@
1
- // Browser entry for the marketing demo. Two features (assets, helpdesk),
1
+ // Browser entry for the marketing demo. Two features (assets, ticketing),
2
2
  // shared shell, everything from the framework defaults.
3
3
 
4
4
  import { localeDeClient } from "@cosmicdrift/kumiko-locale-de/web";
5
5
  import { createKumikoApp } from "@cosmicdrift/kumiko-renderer/web";
6
6
  import { assetsClient } from "../features/assets/web";
7
- import { helpdeskClient } from "../features/helpdesk/web";
7
+ import { ticketingClient } from "../features/ticketing/web";
8
8
  import { AppShell } from "./shell";
9
9
 
10
10
  createKumikoApp({
11
11
  shell: AppShell,
12
- clientFeatures: [localeDeClient(), assetsClient, helpdeskClient],
12
+ clientFeatures: [localeDeClient(), assetsClient, ticketingClient],
13
13
  });
@@ -8,7 +8,7 @@
8
8
  // an immediate compile error here, no silent drift.
9
9
 
10
10
  import type { AssetDepartment, AssetType } from "../features/assets/schema";
11
- import type { TicketCategory, TicketDepartment } from "../features/helpdesk/schema";
11
+ import type { TicketCategory, TicketDepartment } from "../features/ticketing/schema";
12
12
 
13
13
  export interface AssetTemplate {
14
14
  readonly name: string;
@@ -1,7 +1,7 @@
1
1
  // Seed for the marketing demo. Plausible data — asset tracker with ~30
2
- // realistic items (laptops, printers, tools), helpdesk with ~20
2
+ // realistic items (laptops, printers, tools), ticketing with ~20
3
3
  // real-looking tickets. Goes through the normal dispatcher
4
- // (assets:write:asset:create, helpdesk:write:ticket:create) so all
4
+ // (assets:write:asset:create, ticketing:write:ticket:create) so all
5
5
  // pipeline stages (validation, audit, search index) run as with real
6
6
  // requests.
7
7
  //
@@ -13,7 +13,7 @@ import { TestUsers } from "@cosmicdrift/kumiko-framework/seeding";
13
13
  import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
14
14
  import { countAssetsForTenant, countTicketsForTenant } from "../db/queries/seed-counts";
15
15
  import { ASSET_STATUSES } from "../features/assets/schema";
16
- import { TICKET_SEVERITIES, TICKET_STATUSES } from "../features/helpdesk/schema";
16
+ import { TICKET_SEVERITIES, TICKET_STATUSES } from "../features/ticketing/schema";
17
17
  import {
18
18
  ASSET_TEMPLATES,
19
19
  ASSIGNEES,
@@ -121,7 +121,7 @@ export const seedMarketingDemo: SeedFn = async (stack) => {
121
121
  ? 15 + Math.floor(r() * 90)
122
122
  : 30 + Math.floor(r() * 240);
123
123
  await stack.http.write(
124
- "helpdesk:write:ticket:create",
124
+ "ticketing:write:ticket:create",
125
125
  {
126
126
  title: tpl.title,
127
127
  description: `Gemeldet von ${reporter}. Bitte zeitnah prüfen.`,
@@ -4,17 +4,17 @@
4
4
  // JWT (TestUsers.admin) so marketing screenshots can be made
5
5
  // without login friction. Cream/light theme via styles.css.
6
6
  //
7
- // Two features (assets + helpdesk) on one instance — proves the
7
+ // Two features (assets + ticketing) on one instance — proves the
8
8
  // marketing story "several small apps, one platform".
9
9
 
10
10
  import { runDevApp } from "@cosmicdrift/kumiko-dev-server";
11
11
  import { localeDe } from "@cosmicdrift/kumiko-locale-de";
12
12
  import { assetsFeature } from "../features/assets/feature";
13
- import { helpdeskFeature } from "../features/helpdesk/feature";
13
+ import { ticketingFeature } from "../features/ticketing/feature";
14
14
  import { seedMarketingDemo } from "./seed";
15
15
 
16
16
  await runDevApp({
17
- features: [localeDe(), assetsFeature, helpdeskFeature],
17
+ features: [localeDe(), assetsFeature, ticketingFeature],
18
18
  // PORT env overridable — Playwright e2e uses its own port (4179)
19
19
  // so dev mode (4178) can run in parallel.
20
20
  port: Number.parseInt(process.env["PORT"] ?? "4178", 10),
@@ -3,11 +3,11 @@
3
3
 
4
4
  import { defineFeature } from "@cosmicdrift/kumiko-framework/engine";
5
5
  import type { TranslationValue } from "@cosmicdrift/kumiko-framework/ui-types";
6
- import { helpdeskTranslations } from "./i18n";
6
+ import { ticketingTranslations } from "./i18n";
7
7
  import { ticketEditScreen, ticketEntity, ticketListScreen } from "./schema";
8
8
 
9
9
  const openReason =
10
- "demo app: any signed-in user manages every helpdesk ticket; there is no per-user ownership in this sample";
10
+ "demo app: any signed-in user manages every ticketing ticket; there is no per-user ownership in this sample";
11
11
 
12
12
  const openRead = { access: { openToAll: { reason: openReason } } } as const;
13
13
 
@@ -15,18 +15,21 @@ const openWrite = {
15
15
  access: { openToAll: { reason: openReason, personalData: "tenant-members" } },
16
16
  } as const;
17
17
 
18
- // r.translations() wants key-first shape ({key: {de, en}}); helpdeskTranslations
18
+ // r.translations() wants key-first shape ({key: {de, en}}); ticketingTranslations
19
19
  // is locale-first (client TranslationsByLocale shape) — invert here (bracket
20
20
  // notation + fallback avoids TS4111/TS18048 under noUncheckedIndexedAccess).
21
21
  const REQUIRED_I18N: Record<string, { de: TranslationValue; en: TranslationValue }> =
22
22
  Object.fromEntries(
23
- Object.keys(helpdeskTranslations["de"] ?? {}).map((key) => [
23
+ Object.keys(ticketingTranslations["de"] ?? {}).map((key) => [
24
24
  key,
25
- { de: helpdeskTranslations["de"]?.[key] ?? "", en: helpdeskTranslations["en"]?.[key] ?? "" },
25
+ {
26
+ de: ticketingTranslations["de"]?.[key] ?? "",
27
+ en: ticketingTranslations["en"]?.[key] ?? "",
28
+ },
26
29
  ]),
27
30
  );
28
31
 
29
- export const helpdeskFeature = defineFeature("helpdesk", (r) => {
32
+ export const ticketingFeature = defineFeature("ticketing", (r) => {
30
33
  r.translations({ keys: REQUIRED_I18N });
31
34
 
32
35
  r.crud("ticket", ticketEntity, { write: openWrite, read: openRead });
@@ -35,18 +38,18 @@ export const helpdeskFeature = defineFeature("helpdesk", (r) => {
35
38
  r.screen(ticketListScreen);
36
39
 
37
40
  r.nav({
38
- id: "helpdesk",
39
- label: "helpdesk:nav.list",
41
+ id: "ticketing",
42
+ label: "ticketing:nav.list",
40
43
  icon: "mail",
41
44
  order: 20,
42
- screen: "helpdesk:screen:ticket-list",
45
+ screen: "ticketing:screen:ticket-list",
43
46
  });
44
47
  r.nav({
45
48
  id: "ticket-new",
46
- label: "helpdesk:nav.new",
49
+ label: "ticketing:nav.new",
47
50
  icon: "plus",
48
- parent: "helpdesk:nav:helpdesk",
49
- screen: "helpdesk:screen:ticket-edit",
51
+ parent: "ticketing:nav:ticketing",
52
+ screen: "ticketing:screen:ticket-edit",
50
53
  order: 10,
51
54
  });
52
55
  });
@@ -0,0 +1,100 @@
1
+ // Helpdesk-Feature i18n-Bundle. Gleiche Convention wie assets/.
2
+
3
+ import type { TranslationsByLocale } from "@cosmicdrift/kumiko-renderer";
4
+
5
+ export const ticketingTranslations: TranslationsByLocale = {
6
+ de: {
7
+ "ticketing:nav.list": "Helpdesk",
8
+ "ticketing:nav.new": "Neues Ticket",
9
+ "ticketing:actions.edit": "Bearbeiten",
10
+
11
+ "screen:ticket-list.title": "Helpdesk",
12
+ "screen:ticket-edit.title": "Ticket bearbeiten",
13
+
14
+ "ticketing:entity:ticket:field:title": "Titel",
15
+ "ticketing:entity:ticket:field:description": "Beschreibung",
16
+ "ticketing:entity:ticket:field:category": "Kategorie",
17
+ "ticketing:entity:ticket:field:severity": "Schweregrad",
18
+ "ticketing:entity:ticket:field:status": "Status",
19
+ "ticketing:entity:ticket:field:department": "Abteilung",
20
+ "ticketing:entity:ticket:field:assignee": "Zugewiesen an",
21
+ "ticketing:entity:ticket:field:reporter": "Gemeldet von",
22
+ "ticketing:entity:ticket:field:dueDate": "Fällig am",
23
+ "ticketing:entity:ticket:field:spentMinutes": "Aufwand (Min.)",
24
+
25
+ "ticketing:entity:ticket:field:severity:option:low": "Niedrig",
26
+ "ticketing:entity:ticket:field:severity:option:medium": "Mittel",
27
+ "ticketing:entity:ticket:field:severity:option:high": "Hoch",
28
+ "ticketing:entity:ticket:field:severity:option:critical": "Kritisch",
29
+
30
+ "ticketing:entity:ticket:field:status:option:open": "Offen",
31
+ "ticketing:entity:ticket:field:status:option:investigating": "In Bearbeitung",
32
+ "ticketing:entity:ticket:field:status:option:resolved": "Gelöst",
33
+ "ticketing:entity:ticket:field:status:option:closed": "Geschlossen",
34
+
35
+ "ticketing:entity:ticket:field:category:option:hardware": "Hardware",
36
+ "ticketing:entity:ticket:field:category:option:software": "Software",
37
+ "ticketing:entity:ticket:field:category:option:account": "Account",
38
+ "ticketing:entity:ticket:field:category:option:network": "Netzwerk",
39
+ "ticketing:entity:ticket:field:category:option:license": "Lizenz",
40
+ "ticketing:entity:ticket:field:category:option:other": "Sonstiges",
41
+
42
+ "ticketing:entity:ticket:field:department:option:it": "IT",
43
+ "ticketing:entity:ticket:field:department:option:marketing": "Marketing",
44
+ "ticketing:entity:ticket:field:department:option:sales": "Vertrieb",
45
+ "ticketing:entity:ticket:field:department:option:engineering": "Entwicklung",
46
+ "ticketing:entity:ticket:field:department:option:finance": "Finanzen",
47
+ "ticketing:entity:ticket:field:department:option:hr": "Personal",
48
+
49
+ "ticketing:section.ticket": "Ticket",
50
+ "ticketing:section.people": "Personen",
51
+ "ticketing:section.tracking": "Tracking",
52
+ },
53
+ en: {
54
+ "ticketing:nav.list": "Helpdesk",
55
+ "ticketing:nav.new": "New ticket",
56
+ "ticketing:actions.edit": "Edit",
57
+
58
+ "screen:ticket-list.title": "Helpdesk",
59
+ "screen:ticket-edit.title": "Edit ticket",
60
+
61
+ "ticketing:entity:ticket:field:title": "Title",
62
+ "ticketing:entity:ticket:field:description": "Description",
63
+ "ticketing:entity:ticket:field:category": "Category",
64
+ "ticketing:entity:ticket:field:severity": "Severity",
65
+ "ticketing:entity:ticket:field:status": "Status",
66
+ "ticketing:entity:ticket:field:department": "Department",
67
+ "ticketing:entity:ticket:field:assignee": "Assignee",
68
+ "ticketing:entity:ticket:field:reporter": "Reporter",
69
+ "ticketing:entity:ticket:field:dueDate": "Due date",
70
+ "ticketing:entity:ticket:field:spentMinutes": "Time spent (min)",
71
+
72
+ "ticketing:entity:ticket:field:severity:option:low": "Low",
73
+ "ticketing:entity:ticket:field:severity:option:medium": "Medium",
74
+ "ticketing:entity:ticket:field:severity:option:high": "High",
75
+ "ticketing:entity:ticket:field:severity:option:critical": "Critical",
76
+
77
+ "ticketing:entity:ticket:field:status:option:open": "Open",
78
+ "ticketing:entity:ticket:field:status:option:investigating": "Investigating",
79
+ "ticketing:entity:ticket:field:status:option:resolved": "Resolved",
80
+ "ticketing:entity:ticket:field:status:option:closed": "Closed",
81
+
82
+ "ticketing:entity:ticket:field:category:option:hardware": "Hardware",
83
+ "ticketing:entity:ticket:field:category:option:software": "Software",
84
+ "ticketing:entity:ticket:field:category:option:account": "Account",
85
+ "ticketing:entity:ticket:field:category:option:network": "Network",
86
+ "ticketing:entity:ticket:field:category:option:license": "License",
87
+ "ticketing:entity:ticket:field:category:option:other": "Other",
88
+
89
+ "ticketing:entity:ticket:field:department:option:it": "IT",
90
+ "ticketing:entity:ticket:field:department:option:marketing": "Marketing",
91
+ "ticketing:entity:ticket:field:department:option:sales": "Sales",
92
+ "ticketing:entity:ticket:field:department:option:engineering": "Engineering",
93
+ "ticketing:entity:ticket:field:department:option:finance": "Finance",
94
+ "ticketing:entity:ticket:field:department:option:hr": "HR",
95
+
96
+ "ticketing:section.ticket": "Ticket",
97
+ "ticketing:section.people": "People",
98
+ "ticketing:section.tracking": "Tracking",
99
+ },
100
+ };