@cosmicdrift/kumiko-samples 0.364.0 → 0.365.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 (143) hide show
  1. package/LICENSE +1 -1
  2. package/package.json +1 -1
  3. package/packages/bundled-features/package.json +1 -1
  4. package/packages/bundled-features/src/audit/changes.json +12 -0
  5. package/packages/bundled-features/src/audit/feature.ts +1 -1
  6. package/packages/bundled-features/src/audit/run-escape-hatch-retention.ts +63 -11
  7. package/packages/bundled-features/src/auth-email-password/bootstrap.ts +1 -3
  8. package/packages/bundled-features/src/auth-email-password/changes.json +18 -0
  9. package/packages/bundled-features/src/auth-email-password/feature.ts +4 -7
  10. package/packages/bundled-features/src/auth-email-password/handlers/invite-accept-with-login.write.ts +2 -3
  11. package/packages/bundled-features/src/auth-email-password/handlers/invite-create.write.ts +6 -4
  12. package/packages/bundled-features/src/auth-email-password/handlers/switch-tenant-mfa-gate.write.ts +2 -2
  13. package/packages/bundled-features/src/auth-email-password/magic-link-mail.ts +7 -3
  14. package/packages/bundled-features/src/auth-email-password/mail-i18n.ts +10 -0
  15. package/packages/bundled-features/src/billing-foundation/changes.json +12 -0
  16. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +8 -1
  17. package/packages/bundled-features/src/billing-foundation/i18n.ts +6 -0
  18. package/packages/bundled-features/src/billing-foundation/subscription-tier-sync.ts +10 -2
  19. package/packages/bundled-features/src/cap-counter/book-cap-usage.ts +20 -8
  20. package/packages/bundled-features/src/cap-counter/cap-reservation.ts +7 -2
  21. package/packages/bundled-features/src/cap-counter/changes.json +13 -0
  22. package/packages/bundled-features/src/cap-counter/handlers/increment-rolling.write.ts +2 -0
  23. package/packages/bundled-features/src/cap-overview/changes.json +6 -0
  24. package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +2 -1
  25. package/packages/bundled-features/src/cap-overview/handlers/tenant-options.query.ts +2 -1
  26. package/packages/bundled-features/src/channel-discord/discord-channel.ts +4 -2
  27. package/packages/bundled-features/src/channel-email/changes.json +18 -0
  28. package/packages/bundled-features/src/channel-email/email-channel.ts +30 -20
  29. package/packages/bundled-features/src/channel-email/smtp-transport.ts +7 -1
  30. package/packages/bundled-features/src/channel-slack/slack-channel.ts +4 -2
  31. package/packages/bundled-features/src/channel-teams/teams-channel.ts +4 -2
  32. package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +7 -1
  33. package/packages/bundled-features/src/custom-fields/db/queries/retention.ts +2 -2
  34. package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +4 -5
  35. package/packages/bundled-features/src/delivery/attachment-ref.ts +18 -1
  36. package/packages/bundled-features/src/delivery/changes.json +12 -0
  37. package/packages/bundled-features/src/delivery/delivery-service.ts +93 -92
  38. package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
  39. package/packages/bundled-features/src/feature-toggles/changes.json +7 -0
  40. package/packages/bundled-features/src/feature-toggles/toggle-runtime.ts +26 -12
  41. package/packages/bundled-features/src/files-tenant-data/index.ts +3 -1
  42. package/packages/bundled-features/src/form-draft/db/queries/owned-file-refs.ts +12 -3
  43. package/packages/bundled-features/src/form-draft/handlers/discard.write.ts +1 -1
  44. package/packages/bundled-features/src/jobs/changes.json +12 -0
  45. package/packages/bundled-features/src/jobs/job-run-logger.ts +5 -2
  46. package/packages/bundled-features/src/metrics/changes.json +6 -0
  47. package/packages/bundled-features/src/metrics/filters.ts +28 -12
  48. package/packages/bundled-features/src/personal-access-tokens/changes.json +6 -0
  49. package/packages/bundled-features/src/personal-access-tokens/revoke-for-user.ts +7 -8
  50. package/packages/bundled-features/src/secrets/changes.json +6 -0
  51. package/packages/bundled-features/src/secrets/handlers/delete.write.ts +3 -1
  52. package/packages/bundled-features/src/secrets/write-gate.ts +8 -2
  53. package/packages/bundled-features/src/shared/index.ts +8 -0
  54. package/packages/bundled-features/src/shared/resource-image-formats.ts +31 -0
  55. package/packages/bundled-features/src/shared/sharp-input-limits.ts +7 -8
  56. package/packages/bundled-features/src/step-dispatcher/webhook-runner.ts +2 -2
  57. package/packages/bundled-features/src/template-resolver/changes.json +81 -0
  58. package/packages/bundled-features/src/template-resolver/compile-document-body.ts +78 -12
  59. package/packages/bundled-features/src/template-resolver/compile-steps-block.ts +68 -0
  60. package/packages/bundled-features/src/template-resolver/constants.ts +11 -1
  61. package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +3 -0
  62. package/packages/bundled-features/src/template-resolver/document-schema.ts +7 -1
  63. package/packages/bundled-features/src/template-resolver/document-steps.ts +114 -0
  64. package/packages/bundled-features/src/template-resolver/feature.ts +12 -0
  65. package/packages/bundled-features/src/template-resolver/handlers/bundle-import.ts +81 -39
  66. package/packages/bundled-features/src/template-resolver/handlers/collection-set.write.ts +4 -3
  67. package/packages/bundled-features/src/template-resolver/handlers/copy-locale.write.ts +111 -61
  68. package/packages/bundled-features/src/template-resolver/handlers/diff-to-system.query.ts +1 -0
  69. package/packages/bundled-features/src/template-resolver/handlers/import-bundle-system.write.ts +25 -15
  70. package/packages/bundled-features/src/template-resolver/handlers/import-bundle.write.ts +12 -1
  71. package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +12 -2
  72. package/packages/bundled-features/src/template-resolver/handlers/resource-upload.write.ts +48 -9
  73. package/packages/bundled-features/src/template-resolver/handlers/validate.query.ts +4 -1
  74. package/packages/bundled-features/src/template-resolver/index.ts +6 -1
  75. package/packages/bundled-features/src/template-resolver/layout-appearance.ts +25 -9
  76. package/packages/bundled-features/src/template-resolver/mail-constants.ts +4 -0
  77. package/packages/bundled-features/src/template-resolver/resource-image.ts +9 -16
  78. package/packages/bundled-features/src/template-resolver/seeding.ts +2 -0
  79. package/packages/bundled-features/src/template-resolver/store-template-resource.ts +390 -124
  80. package/packages/bundled-features/src/template-resolver/template-bundle.ts +4 -0
  81. package/packages/bundled-features/src/template-resolver/template-draft.ts +1 -1
  82. package/packages/bundled-features/src/template-resolver/template-meta.ts +8 -0
  83. package/packages/bundled-features/src/template-resolver/template-preview.ts +1 -1
  84. package/packages/bundled-features/src/template-resolver/template-resources.ts +2 -43
  85. package/packages/bundled-features/src/template-resolver/template-validation.ts +15 -9
  86. package/packages/bundled-features/src/template-resolver/web/document-editor-extensions.ts +34 -0
  87. package/packages/bundled-features/src/template-resolver/web/document-editor.tsx +3 -2
  88. package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +56 -11
  89. package/packages/bundled-features/src/template-resolver/web/document-toolbar-blocks.ts +6 -3
  90. package/packages/bundled-features/src/template-resolver/web/i18n.ts +7 -0
  91. package/packages/bundled-features/src/template-resolver/web/index.ts +1 -0
  92. package/packages/bundled-features/src/template-resolver/web/placeholder-line-editor.tsx +14 -5
  93. package/packages/bundled-features/src/tenant/changes.json +6 -0
  94. package/packages/bundled-features/src/tenant/handlers/update-member-roles.write.ts +3 -8
  95. package/packages/bundled-features/src/tenant/seeding.ts +33 -27
  96. package/packages/bundled-features/src/tenant-handover/move-entity-graph.ts +14 -3
  97. package/packages/bundled-features/src/tenant-lifecycle/changes.json +6 -0
  98. package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +9 -1
  99. package/packages/bundled-features/src/tenant-lifecycle/stages.ts +3 -2
  100. package/packages/bundled-features/src/tier-engine/changes.json +12 -0
  101. package/packages/bundled-features/src/tier-engine/constants.ts +9 -0
  102. package/packages/bundled-features/src/tier-engine/entity.ts +9 -4
  103. package/packages/bundled-features/src/tier-engine/handlers/set-tenant-tier.write.ts +8 -5
  104. package/packages/bundled-features/src/tier-engine/index.ts +2 -0
  105. package/packages/bundled-features/src/user/constants.ts +1 -0
  106. package/packages/bundled-features/src/user/invited-global-roles.ts +2 -4
  107. package/packages/bundled-features/src/user-data-rights/changes.json +6 -0
  108. package/packages/bundled-features/src/user-data-rights/email-templates.ts +0 -1
  109. package/packages/bundled-features/src/user-data-rights/i18n.ts +5 -0
  110. package/packages/bundled-features/src/user-data-rights/lib/update-user-lifecycle.ts +13 -2
  111. package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +7 -1
  112. package/packages/bundled-features/src/waitlist/changes.json +18 -0
  113. package/packages/bundled-features/src/waitlist/feature.ts +1 -1
  114. package/packages/bundled-features/src/waitlist/handlers/invite.write.ts +35 -3
  115. package/packages/bundled-features/src/waitlist/handlers/reject.write.ts +2 -17
  116. package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +33 -9
  117. package/packages/bundled-features/src/waitlist/i18n.ts +9 -0
  118. package/packages/bundled-features/src/waitlist/lib.ts +20 -0
  119. package/packages/bundled-features/src/workflow-runner/feature.ts +1 -1
  120. package/samples/apps/ui-walkthrough/src/run-config.ts +14 -1
  121. package/samples/apps/use-all-bundled/README.md +3 -13
  122. package/samples/apps/use-all-bundled/feature-manifest.json +3 -3
  123. package/samples/apps/use-all-bundled/scripts/check-coverage.ts +34 -118
  124. package/samples/apps/use-all-bundled/src/app/notes-feature.ts +1 -1
  125. package/samples/apps/use-all-bundled/src/run-config.ts +0 -3
  126. package/samples/recipes/auth-mfa/README.md +2 -1
  127. package/samples/recipes/auth-mfa/src/feature.ts +1 -0
  128. package/samples/recipes/custom-handlers/README.md +4 -3
  129. package/samples/recipes/custom-handlers/src/feature.ts +21 -12
  130. package/samples/recipes/dashboard-stats/README.md +38 -0
  131. package/samples/recipes/dashboard-stats/package.json +8 -0
  132. package/samples/recipes/dashboard-stats/src/feature.ts +104 -0
  133. package/samples/recipes/legal-pages/README.md +2 -2
  134. package/samples/recipes/managed-pages/README.md +2 -2
  135. package/samples/recipes/pdf-audit-export/README.md +2 -1
  136. package/samples/recipes/pdf-audit-export/package.json +1 -1
  137. package/samples/recipes/pdf-audit-export/src/feature.ts +68 -48
  138. package/samples/recipes/workflow-engine/src/db/queries/suspended-runs.ts +2 -2
  139. package/samples/apps/use-all-bundled/schema/generate.ts +0 -617
  140. package/samples/apps/use-all-bundled/schema/migrations/meta/0000_snapshot.json +0 -3055
  141. package/samples/apps/use-all-bundled/schema/migrations/meta/_journal.json +0 -13
  142. package/samples/apps/use-all-bundled/schema/schema.generated.ts +0 -94
  143. package/samples/apps/use-all-bundled/schema/schema.ts +0 -9
@@ -1,617 +0,0 @@
1
- #!/usr/bin/env bun
2
- // @runtime dev
3
- // biome-ignore-all lint/suspicious/noConsole: CLI-Script, console ist Feature.
4
- //
5
- // Regeneriert schema.generated.ts (Entity-Tables) für die use-all-bundled
6
- // Smoke-App. Pattern aus einer vergleichbaren Studio-App adaptiert auf
7
- // die 29 bundled-features die hier gemountet sind (siehe ../src/run-config.ts).
8
- //
9
- // Usage:
10
- // bun run schema/generate.ts
11
- //
12
- // Output: schema/schema.generated.ts.
13
- // Erweitern wenn use-all-bundled ein neues bundled-Feature mountet:
14
- // FEATURE_IMPORT_REGISTRY hier ergänzen. Memory-würdig dass die Liste
15
- // mit run-config.ts in Sync bleibt — wird in M5 als Lint-Guard verdrahtet.
16
-
17
- import { writeFileSync } from "node:fs";
18
- import { resolve } from "node:path";
19
- import { composeFeatures } from "@cosmicdrift/kumiko-server-runtime/compose-features";
20
- import { APP_FEATURES, AUTH_COMPOSE_OPTIONS } from "../src/run-config";
21
-
22
- type FeatureImport = (
23
- | {
24
- readonly kind: "factory";
25
- readonly path: string;
26
- readonly factory: string;
27
- // Literal args rendered inside the factory call, for factories with a
28
- // required parameter (e.g. managed-pages' resolveApexTenant). Only the
29
- // entity shape is consumed here, so a no-op stub is sufficient.
30
- readonly defaultArgs?: string;
31
- }
32
- | {
33
- readonly kind: "named";
34
- readonly path: string;
35
- readonly exportName: string;
36
- }
37
- ) & {
38
- readonly projectionTables?: readonly string[];
39
- };
40
-
41
- const FEATURE_IMPORT_REGISTRY: Record<string, FeatureImport> = {
42
- config: {
43
- kind: "factory",
44
- path: "@cosmicdrift/kumiko-bundled-features/config",
45
- factory: "createConfigFeature",
46
- },
47
- user: {
48
- kind: "factory",
49
- path: "@cosmicdrift/kumiko-bundled-features/user",
50
- factory: "createUserFeature",
51
- },
52
- tenant: {
53
- kind: "factory",
54
- path: "@cosmicdrift/kumiko-bundled-features/tenant",
55
- factory: "createTenantFeature",
56
- },
57
- secrets: {
58
- kind: "factory",
59
- path: "@cosmicdrift/kumiko-bundled-features/secrets",
60
- factory: "createSecretsFeature",
61
- },
62
- sessions: {
63
- kind: "factory",
64
- path: "@cosmicdrift/kumiko-bundled-features/sessions",
65
- factory: "createSessionsFeature",
66
- },
67
- "personal-access-tokens": {
68
- kind: "factory",
69
- path: "@cosmicdrift/kumiko-bundled-features/personal-access-tokens",
70
- factory: "createPersonalAccessTokensFeature",
71
- defaultArgs: "{ scopes: {} }",
72
- },
73
- // Owns the tokenVerifier extension-point personal-access-tokens registers
74
- // against. No r.entity → generate.ts skips it silently. Listed for
75
- // schema-check ↔ mounted-set consistency (kumiko-framework#1369).
76
- "auth-foundation": {
77
- kind: "named",
78
- path: "@cosmicdrift/kumiko-bundled-features/auth-foundation",
79
- exportName: "authFoundationFeature",
80
- },
81
- // auth-email-password auto-mounted via composeFeatures(includeBundled:true).
82
- // Kein r.entity → generate.ts skipt silent. Listed für schema-check ↔
83
- // mounted-set Konsistenz.
84
- "auth-email-password": {
85
- kind: "factory",
86
- path: "@cosmicdrift/kumiko-bundled-features/auth-email-password",
87
- factory: "createAuthEmailPasswordFeature",
88
- },
89
- // Companion toggle auto-mounted by composeFeatures when authOptions.signup
90
- // is set (#1521). No r.entity — listed for schema-check parity.
91
- "auth-self-registration": {
92
- kind: "factory",
93
- path: "@cosmicdrift/kumiko-bundled-features/auth-email-password",
94
- factory: "createAuthSelfRegistrationToggleFeature",
95
- },
96
- // Opt-in German copy. No r.entity — listed for schema-check ↔ mounted-set.
97
- "locale-de": {
98
- kind: "factory",
99
- path: "@cosmicdrift/kumiko-locale-de",
100
- factory: "localeDe",
101
- },
102
- "auth-mfa": {
103
- kind: "factory",
104
- path: "@cosmicdrift/kumiko-bundled-features/auth-mfa",
105
- factory: "createAuthMfaFeature",
106
- defaultArgs:
107
- '{ setupTokenSecret: "stub-setup-secret-at-least-32-bytes-long!!", challengeTokenSecret: "stub-challenge-secret-at-least-32-bytes!!", issuer: "stub" }',
108
- },
109
- delivery: {
110
- kind: "factory",
111
- path: "@cosmicdrift/kumiko-bundled-features/delivery",
112
- factory: "createDeliveryFeature",
113
- projectionTables: ["deliveryAttemptsTable"],
114
- },
115
- "channel-in-app": {
116
- kind: "factory",
117
- path: "@cosmicdrift/kumiko-bundled-features/channel-in-app",
118
- factory: "createChannelInAppFeature",
119
- },
120
- "mail-foundation": {
121
- kind: "named",
122
- path: "@cosmicdrift/kumiko-bundled-features/mail-foundation",
123
- exportName: "mailFoundationFeature",
124
- },
125
- "mail-transport-inmemory": {
126
- kind: "named",
127
- path: "@cosmicdrift/kumiko-bundled-features/mail-transport-inmemory",
128
- exportName: "mailTransportInMemoryFeature",
129
- },
130
- "inbound-mail-foundation": {
131
- kind: "named",
132
- path: "@cosmicdrift/kumiko-bundled-features/inbound-mail-foundation",
133
- exportName: "inboundMailFoundationFeature",
134
- projectionTables: [
135
- "mailAccountsProjectionTable",
136
- "inboundMessagesProjectionTable",
137
- "mailThreadsProjectionTable",
138
- ],
139
- },
140
- "inbound-provider-imap": {
141
- kind: "named",
142
- path: "@cosmicdrift/kumiko-bundled-features/inbound-provider-imap",
143
- exportName: "inboundProviderImapFeature",
144
- },
145
- "inbound-provider-inmemory": {
146
- kind: "named",
147
- path: "@cosmicdrift/kumiko-bundled-features/inbound-provider-inmemory",
148
- exportName: "inboundProviderInMemoryFeature",
149
- },
150
- "file-foundation": {
151
- kind: "named",
152
- path: "@cosmicdrift/kumiko-bundled-features/file-foundation",
153
- exportName: "fileFoundationFeature",
154
- },
155
- "file-provider-inmemory": {
156
- kind: "named",
157
- path: "@cosmicdrift/kumiko-bundled-features/file-provider-inmemory",
158
- exportName: "fileProviderInMemoryFeature",
159
- },
160
- "file-derivatives": {
161
- kind: "named",
162
- path: "@cosmicdrift/kumiko-bundled-features/file-derivatives",
163
- exportName: "fileDerivativesFeature",
164
- },
165
- "derivatives-sharp": {
166
- kind: "named",
167
- path: "@cosmicdrift/kumiko-bundled-features/derivatives-sharp",
168
- exportName: "derivativesSharpFeature",
169
- },
170
- "file-provider-s3-env": {
171
- kind: "named",
172
- path: "@cosmicdrift/kumiko-bundled-features/file-provider-s3-env",
173
- exportName: "fileProviderS3EnvFeature",
174
- },
175
- files: {
176
- kind: "factory",
177
- path: "@cosmicdrift/kumiko-bundled-features/files",
178
- factory: "createFilesFeature",
179
- },
180
- "files-tenant-data": {
181
- kind: "factory",
182
- path: "@cosmicdrift/kumiko-bundled-features/files-tenant-data",
183
- factory: "createFilesTenantDataFeature",
184
- },
185
- "billing-foundation": {
186
- kind: "named",
187
- path: "@cosmicdrift/kumiko-bundled-features/billing-foundation",
188
- exportName: "billingFoundationFeature",
189
- projectionTables: ["subscriptionsProjectionTable"],
190
- },
191
- "tier-engine": {
192
- kind: "named",
193
- path: "@cosmicdrift/kumiko-bundled-features/tier-engine",
194
- exportName: "tierEngineFeature",
195
- },
196
- // cap-overview: no r.entity of its own (reads tier-engine/billing-
197
- // foundation/tenant + caller-supplied CapSpec callbacks) — this entry
198
- // never renders into schema.generated.ts, listed only for check-coverage
199
- // ↔ mounted-set consistency. defaultArgs mirrors run-config.ts's real
200
- // CAP_OVERVIEW_CAPS shape so it stays buildable if entities are added later.
201
- "cap-overview": {
202
- kind: "factory",
203
- path: "@cosmicdrift/kumiko-bundled-features/cap-overview",
204
- factory: "createCapOverviewFeature",
205
- defaultArgs: '{ caps: [{ id: "stub", label: "stub", limit: () => 0, usage: async () => 0 }] }',
206
- },
207
- // cap-overview-labels: app-local, translations only for the example
208
- // cap ids this sample chose — same pattern as collection-labels below.
209
- "cap-overview-labels": {
210
- kind: "named",
211
- path: "../src/app/cap-overview-labels-feature",
212
- exportName: "capOverviewLabelsFeature",
213
- },
214
- // metrics / metrics-system: no entities, so they never render into
215
- // schema.generated.ts; the empty metric list is a build stub only.
216
- metrics: {
217
- kind: "factory",
218
- path: "@cosmicdrift/kumiko-bundled-features/metrics",
219
- factory: "createMetricsFeature",
220
- defaultArgs: "{ metrics: [] }",
221
- },
222
- "metrics-system": {
223
- kind: "factory",
224
- path: "@cosmicdrift/kumiko-bundled-features/metrics",
225
- factory: "createSystemMetricsFeature",
226
- defaultArgs: "{ metrics: [] }",
227
- },
228
- "cap-counter": {
229
- kind: "named",
230
- path: "@cosmicdrift/kumiko-bundled-features/cap-counter",
231
- exportName: "capCounterFeature",
232
- },
233
- jobs: {
234
- kind: "factory",
235
- path: "@cosmicdrift/kumiko-bundled-features/jobs",
236
- factory: "createJobsFeature",
237
- projectionTables: ["jobRunsTable", "jobRunLogsTable"],
238
- },
239
- "step-dispatcher": {
240
- kind: "factory",
241
- path: "@cosmicdrift/kumiko-bundled-features/step-dispatcher",
242
- factory: "createStepDispatcherFeature",
243
- },
244
- "compliance-profiles": {
245
- kind: "factory",
246
- path: "@cosmicdrift/kumiko-bundled-features/compliance-profiles",
247
- factory: "createComplianceProfilesFeature",
248
- },
249
- "tenant-lifecycle": {
250
- kind: "factory",
251
- path: "@cosmicdrift/kumiko-bundled-features/tenant-lifecycle",
252
- factory: "createTenantLifecycleFeature",
253
- },
254
- // No r.entity of its own — it reads OTHER entities' `transferable`/
255
- // `parentRef` declarations off the registry. generate.ts skips it
256
- // silently; listed for schema-check ↔ mounted-set parity.
257
- "tenant-handover": {
258
- kind: "factory",
259
- path: "@cosmicdrift/kumiko-bundled-features/tenant-handover",
260
- factory: "createTenantHandoverFeature",
261
- },
262
- "data-retention": {
263
- kind: "factory",
264
- path: "@cosmicdrift/kumiko-bundled-features/data-retention",
265
- factory: "createDataRetentionFeature",
266
- },
267
- "user-data-rights": {
268
- kind: "factory",
269
- path: "@cosmicdrift/kumiko-bundled-features/user-data-rights",
270
- factory: "createUserDataRightsFeature",
271
- },
272
- "user-data-rights-defaults": {
273
- kind: "factory",
274
- path: "@cosmicdrift/kumiko-bundled-features/user-data-rights-defaults",
275
- factory: "createUserDataRightsDefaultsFeature",
276
- },
277
- "user-profile": {
278
- kind: "factory",
279
- path: "@cosmicdrift/kumiko-bundled-features/user-profile",
280
- factory: "createUserProfileFeature",
281
- },
282
- "legal-pages": {
283
- kind: "factory",
284
- path: "@cosmicdrift/kumiko-bundled-features/legal-pages",
285
- factory: "createLegalPagesFeature",
286
- },
287
- waitlist: {
288
- kind: "factory",
289
- path: "@cosmicdrift/kumiko-bundled-features/waitlist",
290
- factory: "createWaitlistFeature",
291
- },
292
- "managed-pages": {
293
- kind: "factory",
294
- path: "@cosmicdrift/kumiko-bundled-features/managed-pages",
295
- factory: "createManagedPagesFeature",
296
- defaultArgs: "{ resolveApexTenant: () => null, allowCustomCss: true }",
297
- },
298
- seo: {
299
- kind: "factory",
300
- path: "@cosmicdrift/kumiko-bundled-features/seo",
301
- factory: "createSeoFeature",
302
- defaultArgs: "{ sitemapEntries: () => [], includeLegalPages: true }",
303
- },
304
- // Mounted in run-config (#1581); coverage lint requires registry parity.
305
- "tenant-settings": {
306
- kind: "factory",
307
- path: "@cosmicdrift/kumiko-bundled-features/tenant-settings",
308
- factory: "createTenantSettingsFeature",
309
- },
310
- "template-resolver": {
311
- kind: "factory",
312
- path: "@cosmicdrift/kumiko-bundled-features/template-resolver",
313
- factory: "createTemplateResolverFeature",
314
- },
315
- "document-designer": {
316
- kind: "factory",
317
- path: "@cosmicdrift/kumiko-document-designer",
318
- factory: "createDocumentDesignerFeature",
319
- },
320
- "renderer-foundation": {
321
- kind: "factory",
322
- path: "@cosmicdrift/kumiko-bundled-features/renderer-foundation",
323
- factory: "createRendererFoundationFeature",
324
- },
325
- "renderer-mail-html": {
326
- kind: "factory",
327
- path: "@cosmicdrift/kumiko-renderer-mail-html",
328
- factory: "createRendererMailHtmlFeature",
329
- },
330
- "renderer-puppeteer-client": {
331
- kind: "factory",
332
- path: "@cosmicdrift/kumiko-renderer-puppeteer-client",
333
- factory: "createRendererPuppeteerClientFeature",
334
- },
335
- "renderer-pdf": {
336
- kind: "factory",
337
- path: "@cosmicdrift/kumiko-bundled-features/renderer-pdf",
338
- factory: "createRendererPdfFeature",
339
- },
340
- "rate-limiting": {
341
- kind: "factory",
342
- path: "@cosmicdrift/kumiko-bundled-features/rate-limiting",
343
- factory: "createRateLimitingFeature",
344
- },
345
- audit: {
346
- kind: "factory",
347
- path: "@cosmicdrift/kumiko-bundled-features/audit",
348
- factory: "createAuditFeature",
349
- },
350
- // admin-shell: workspaces + nav only, kein r.entity → generate.ts skipt
351
- // silent. Listed für schema-check ↔ mounted-set Konsistenz.
352
- "admin-shell": {
353
- kind: "factory",
354
- path: "@cosmicdrift/kumiko-bundled-features/admin-shell",
355
- factory: "createAdminShellFeature",
356
- },
357
- // agent-tools: tool catalog + boot-time doc lint only, no r.entity — the
358
- // generator skips it and it is listed purely for the schema-check ↔
359
- // mounted-set consistency.
360
- "agent-tools": {
361
- kind: "factory",
362
- path: "@cosmicdrift/kumiko-bundled-features/agent-tools",
363
- factory: "createAgentToolsFeature",
364
- },
365
- // compliance-profiles-ops: just a cross-tenant read on tenant/
366
- // compliance-profiles, no own r.entity → generate.ts skips silently.
367
- "compliance-profiles-ops": {
368
- kind: "named",
369
- path: "@cosmicdrift/kumiko-bundled-features/compliance-profiles-ops",
370
- exportName: "complianceProfilesOpsFeature",
371
- },
372
- "crypto-shredding": {
373
- kind: "factory",
374
- path: "@cosmicdrift/kumiko-bundled-features/crypto-shredding",
375
- factory: "createCryptoShreddingFeature",
376
- },
377
- "custom-fields": {
378
- kind: "named",
379
- path: "@cosmicdrift/kumiko-bundled-features/custom-fields",
380
- exportName: "customFieldsFeature",
381
- },
382
- tags: {
383
- kind: "named",
384
- path: "@cosmicdrift/kumiko-bundled-features/tags",
385
- exportName: "tagsFeature",
386
- },
387
- "notes-history": {
388
- kind: "named",
389
- path: "@cosmicdrift/kumiko-bundled-features/notes-history",
390
- exportName: "notesHistoryFeature",
391
- },
392
- "notes-history-user-data": {
393
- kind: "named",
394
- path: "@cosmicdrift/kumiko-bundled-features/notes-history-user-data",
395
- exportName: "notesHistoryUserDataFeature",
396
- },
397
- "form-draft": {
398
- kind: "named",
399
- path: "@cosmicdrift/kumiko-bundled-features/form-draft",
400
- exportName: "formDraftFeature",
401
- },
402
- "form-draft-user-data": {
403
- kind: "named",
404
- path: "@cosmicdrift/kumiko-bundled-features/form-draft-user-data",
405
- exportName: "formDraftUserDataFeature",
406
- },
407
- "template-resolver-user-data": {
408
- kind: "named",
409
- path: "@cosmicdrift/kumiko-bundled-features/template-resolver-user-data",
410
- exportName: "templateResolverUserDataFeature",
411
- },
412
- // collection-labels: app-local, translations only, kein r.entity →
413
- // generate.ts skipt silent. Listed für schema-check ↔ mounted-set Konsistenz.
414
- "collection-labels": {
415
- kind: "named",
416
- path: "../src/app/collection-labels-feature",
417
- exportName: "collectionLabelsFeature",
418
- },
419
- folders: {
420
- kind: "named",
421
- path: "@cosmicdrift/kumiko-bundled-features/folders",
422
- exportName: "foldersFeature",
423
- },
424
- "folders-user-data": {
425
- kind: "named",
426
- path: "@cosmicdrift/kumiko-bundled-features/folders-user-data",
427
- exportName: "foldersUserDataFeature",
428
- },
429
- "auth-mfa-user-data": {
430
- kind: "named",
431
- path: "@cosmicdrift/kumiko-bundled-features/auth-mfa-user-data",
432
- exportName: "authMfaUserDataFeature",
433
- },
434
- ledger: {
435
- kind: "named",
436
- path: "@cosmicdrift/kumiko-bundled-features/ledger",
437
- exportName: "ledgerFeature",
438
- },
439
- "document-ingest-foundation": {
440
- kind: "named",
441
- path: "@cosmicdrift/kumiko-bundled-features/document-ingest-foundation",
442
- exportName: "documentIngestFoundationFeature",
443
- },
444
- // workflow-runner: no r.entity/MSPs/handlers → generate.ts skips it
445
- // silently. Listed for schema-check ↔ mounted-set consistency.
446
- "workflow-runner": {
447
- kind: "named",
448
- path: "@cosmicdrift/kumiko-bundled-features/workflow-runner",
449
- exportName: "workflowRunnerFeature",
450
- },
451
- // M0.1 hold-back features. Meist keine eigenen entities/projection-tables
452
- // (generate.ts skipt sie silent in der entity-loop) — gelistet für
453
- // check-coverage.ts (Maintenance-Lint M5 erwartet jeden mounted
454
- // feature-export im Registry). Ausnahme: feature-toggles trägt die
455
- // Store-Table store_global_feature_state (r.storeTable, siehe
456
- // global-feature-state-table.ts) — der projectionTables-Key hier steuert
457
- // nur den Drizzle-Schema-Export, ist keine echte Projection.
458
- "channel-email": {
459
- kind: "factory",
460
- path: "@cosmicdrift/kumiko-bundled-features/channel-email",
461
- factory: "createChannelEmailFeature",
462
- },
463
- "channel-push": {
464
- kind: "factory",
465
- path: "@cosmicdrift/kumiko-bundled-features/channel-push",
466
- factory: "createChannelPushFeature",
467
- },
468
- "channel-slack": {
469
- kind: "factory",
470
- path: "@cosmicdrift/kumiko-bundled-features/channel-slack",
471
- factory: "createChannelSlackFeature",
472
- },
473
- "channel-discord": {
474
- kind: "factory",
475
- path: "@cosmicdrift/kumiko-bundled-features/channel-discord",
476
- factory: "createChannelDiscordFeature",
477
- },
478
- "channel-teams": {
479
- kind: "factory",
480
- path: "@cosmicdrift/kumiko-bundled-features/channel-teams",
481
- factory: "createChannelTeamsFeature",
482
- },
483
- "channel-telegram": {
484
- kind: "factory",
485
- path: "@cosmicdrift/kumiko-bundled-features/channel-telegram",
486
- factory: "createChannelTelegramFeature",
487
- },
488
- readiness: {
489
- kind: "named",
490
- path: "@cosmicdrift/kumiko-bundled-features/readiness",
491
- exportName: "readinessFeature",
492
- },
493
- "mail-transport-smtp": {
494
- kind: "named",
495
- path: "@cosmicdrift/kumiko-bundled-features/mail-transport-smtp",
496
- exportName: "mailTransportSmtpFeature",
497
- },
498
- "file-provider-s3": {
499
- kind: "named",
500
- path: "@cosmicdrift/kumiko-bundled-features/file-provider-s3",
501
- exportName: "fileProviderS3Feature",
502
- },
503
- "subscription-stripe": {
504
- kind: "factory",
505
- path: "@cosmicdrift/kumiko-bundled-features/subscription-stripe",
506
- factory: "createSubscriptionStripeFeature",
507
- },
508
- "subscription-mollie": {
509
- kind: "factory",
510
- path: "@cosmicdrift/kumiko-bundled-features/subscription-mollie",
511
- factory: "createSubscriptionMollieFeature",
512
- },
513
- "feature-toggles": {
514
- kind: "factory",
515
- path: "@cosmicdrift/kumiko-bundled-features/feature-toggles",
516
- factory: "createFeatureTogglesFeature",
517
- projectionTables: ["globalFeatureStateTable"],
518
- },
519
- };
520
-
521
- const features = composeFeatures([...APP_FEATURES], {
522
- includeBundled: true,
523
- authOptions: AUTH_COMPOSE_OPTIONS,
524
- });
525
-
526
- const importLines: string[] = [
527
- 'import { buildEntityTable } from "@cosmicdrift/kumiko-framework/db";',
528
- ];
529
- const constLines: string[] = [];
530
- const seenFeature = new Set<string>();
531
- const featureVarNames = new Map<string, string>();
532
- const projectionTableReexports: Array<{
533
- readonly path: string;
534
- readonly tables: readonly string[];
535
- }> = [];
536
-
537
- for (const feature of features) {
538
- const hasEntities = Object.keys(feature.entities).length > 0;
539
- const entry = FEATURE_IMPORT_REGISTRY[feature.name];
540
- const hasProjectionTables = entry !== undefined && (entry.projectionTables?.length ?? 0) > 0;
541
- if (!hasEntities && !hasProjectionTables) continue;
542
- if (seenFeature.has(feature.name)) continue;
543
- seenFeature.add(feature.name);
544
-
545
- if (!entry) {
546
- throw new Error(
547
- `schema/generate.ts: feature "${feature.name}" has no import entry. ` +
548
- `Add it to FEATURE_IMPORT_REGISTRY at the top of this file.`,
549
- );
550
- }
551
-
552
- if (hasEntities) {
553
- const varName = toIdent(`_${feature.name}`);
554
- featureVarNames.set(feature.name, varName);
555
- if (entry.kind === "factory") {
556
- importLines.push(`import { ${entry.factory} } from "${entry.path}";`);
557
- constLines.push(`const ${varName} = ${entry.factory}(${entry.defaultArgs ?? ""});`);
558
- } else {
559
- importLines.push(`import { ${entry.exportName} } from "${entry.path}";`);
560
- constLines.push(`const ${varName} = ${entry.exportName};`);
561
- }
562
- }
563
-
564
- if (hasProjectionTables && entry.projectionTables) {
565
- projectionTableReexports.push({
566
- path: entry.path,
567
- tables: entry.projectionTables,
568
- });
569
- }
570
- }
571
-
572
- const lines: string[] = [
573
- "// Auto-generated by schema/generate.ts — DO NOT EDIT",
574
- "// Re-run: bun run schema/generate.ts",
575
- "// biome-ignore-all format: generated output",
576
- "// biome-ignore-all assist/source/organizeImports: generated output",
577
- "// biome-ignore-all lint/style/noNonNullAssertion: generated output — entity-lookup ist immer present per registry-contract",
578
- "",
579
- ...importLines,
580
- "",
581
- ...constLines,
582
- "",
583
- ];
584
-
585
- let entityCount = 0;
586
- const seenEntityFeature = new Set<string>();
587
- for (const feature of features) {
588
- const varName = featureVarNames.get(feature.name);
589
- if (!varName) continue;
590
- if (seenEntityFeature.has(feature.name)) continue;
591
- seenEntityFeature.add(feature.name);
592
- for (const entityName of Object.keys(feature.entities)) {
593
- const exportName = `${toIdent(entityName)}Table`;
594
- lines.push(
595
- `export const ${exportName} = buildEntityTable("${entityName}", ${varName}.entities["${entityName}"]!);`,
596
- );
597
- entityCount++;
598
- }
599
- }
600
-
601
- let projectionTableCount = 0;
602
- for (const { path, tables } of projectionTableReexports) {
603
- lines.push(`export { ${tables.join(", ")} } from "${path}";`);
604
- projectionTableCount += tables.length;
605
- }
606
-
607
- lines.push("");
608
-
609
- const outPath = resolve(import.meta.dir, "schema.generated.ts");
610
- writeFileSync(outPath, lines.join("\n"), "utf-8");
611
- console.log(
612
- ` Entity-Tables: ${entityCount} + Projection-Tables: ${projectionTableCount} → schema.generated.ts`,
613
- );
614
-
615
- function toIdent(name: string): string {
616
- return name.replace(/-([a-z0-9])/g, (_, c: string) => c.toUpperCase());
617
- }