@cosmicdrift/kumiko-samples 0.413.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-samples",
3
- "version": "0.413.0",
3
+ "version": "0.413.1",
4
4
  "description": "Source trees of the Kumiko sample recipes, sample apps and bundled features in repo layout, for tooling such as few-shot corpus builds.",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-bundled-features",
3
- "version": "0.413.0",
3
+ "version": "0.413.1",
4
4
  "description": "Built-in features — tenant, user, auth, delivery. The stuff you'd rewrite anyway, already typed.",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.413.1",
4
+ "type": "fix",
5
+ "title": "Retention cleanup, upload sweep and soft-delete cleanup reach the system tenant",
6
+ "detail": "Jobs with `perTenant: true` can set `includeSystemTenant: true` to get one more run with `SYSTEM_TENANT_ID` after the active tenants (no duplicate if the app's `getActiveTenantIds` already returns it). `data-retention:job:retention-cleanup`, `files:job:sweep-orphaned-uploads` and `soft-delete:job:cleanup` set it, so helpdesk requests, replies and their attachments are deleted after `keepFor`. The retention run applies to every entity with a `retention` rule whose rows sit in the system tenant (for example download attempts or custom-field values written in a SystemAdmin session); they now expire after their declared `keepFor` like in any other tenant. Other per-tenant jobs (tenant inactivity, billing, workflows, reindex, inbound-mail retention) keep running for active tenants only. The soft-delete cleanup computes its grace cutoff from the job clock instead of the wall clock. Setting `includeSystemTenant` without `perTenant` fails at boot."
7
+ },
2
8
  {
3
9
  "version": "0.407.0",
4
10
  "type": "fix",
@@ -65,8 +65,8 @@ export function createDataRetentionFeature(): FeatureDefinition {
65
65
  r.exposesApi("retention.policyFor");
66
66
  r.queryHandler(policyForQuery);
67
67
 
68
- // Autonomous retention cleanup. perTenant fan-out (one run per
69
- // active tenant, like soft-delete-cleanup): runRetentionCleanup's raw
68
+ // Autonomous retention cleanup. perTenant fan-out (one run per active
69
+ // tenant plus the system tenant, like soft-delete-cleanup): runRetentionCleanup's raw
70
70
  // query helpers need the unfiltered runner, so the handler declares
71
71
  // escapeHatch and reaches for ctx.db.unsafeRaw(). Without this cron,
72
72
  // retention rules are configured but never enforced.
@@ -74,6 +74,7 @@ export function createDataRetentionFeature(): FeatureDefinition {
74
74
  name: "retention-cleanup",
75
75
  trigger: { maintenance: true },
76
76
  perTenant: true,
77
+ includeSystemTenant: true,
77
78
  concurrency: "skip",
78
79
  escapeHatch: {
79
80
  reason:
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "version": "0.413.1",
4
+ "type": "improvement",
5
+ "title": "helpdesk sample: complete same-origin contact page",
6
+ "detail": "`samples/apps/use-all-bundled/public/helpdesk-contact.html` (with `.js` and `.css`) loads `/helpdesk/client.js`, builds the form from `load()` (kinds, optional phone), submits with proof of work and a hidden honeypot field and shows the sent, rate-limited and failed states. Two Playwright specs cover a real submit that reaches the SystemAdmin inbox and a honeypot submit that stores nothing."
7
+ },
8
+ {
9
+ "version": "0.413.1",
10
+ "type": "fix",
11
+ "title": "helpdesk recipe: client script same-origin, notes-history listed as required",
12
+ "detail": "The recipe comment embedded `/helpdesk/client.js` from another origin, but the client posts to the relative paths `/api/query` and `/api/write` without cookies, so the page has to share the app's origin or forward `/api` to the app on its own origin. The recipe and its README now say so and list `notes-history` with `config`, `delivery`, `user-data-rights` and `files` as required features."
13
+ },
2
14
  {
3
15
  "version": "0.413.0",
4
16
  "type": "breaking",
@@ -10,7 +10,8 @@ SystemAdmins reply from the admin. Phone is off and Telegram is not mounted unle
10
10
  turns them on (`fields.phone`, `telegram: true`).
11
11
 
12
12
  **What the recipe demonstrates:**
13
- - Mounting `createHelpdeskFeature` with its companions (delivery, user-data-rights, files)
13
+ - Mounting `createHelpdeskFeature` with its companions (config, delivery, user-data-rights,
14
+ files, notes-history)
14
15
  - The anonymous flow: `helpdesk:query:challenge` hands out a proof-of-work challenge,
15
16
  `helpdesk:write:submit` verifies it; spam gets the same 200 body and stores nothing
16
17
  - The browser client at `GET /helpdesk/client.js` (`window.KumikoHelpdesk.load()` / `submit()`)
@@ -40,12 +41,15 @@ bun test --config=bunfig.integration.toml samples/recipes/helpdesk
40
41
  ## Integration into a real app
41
42
 
42
43
  1. Mount `createHelpdeskFeature({ appName })` plus delivery, a mail channel, `user-data-rights`,
43
- `files` with a file provider and `config`.
44
+ `files` with a file provider, `notes-history` and `config`.
44
45
  2. Run `kumiko schema generate` (new tables, plus the delivery `idempotency_key` column).
45
46
  3. SystemAdmins set `helpdesk:config:reply-to` in the admin.
46
- 4. Embed `/helpdesk/client.js` on the website; the form is yours. A website served by another
47
- server can serve the same script from `HELPDESK_CLIENT_SOURCE` and type its calls with
48
- `HelpdeskWebsiteClient`, both from `@cosmicdrift/kumiko-bundled-features/helpdesk/client`.
47
+ 4. Embed `/helpdesk/client.js` on the website; the form is yours. The client posts to the
48
+ relative paths `/api/query` and `/api/write` without cookies, so the page has to share the
49
+ app's origin. A website served by another server forwards `/api` to the app on its own
50
+ origin; it can then serve the same script from `HELPDESK_CLIENT_SOURCE` and type its calls
51
+ with `HelpdeskWebsiteClient`, both from `@cosmicdrift/kumiko-bundled-features/helpdesk/client`.
52
+ `samples/apps/use-all-bundled/public/helpdesk-contact.html` (with `helpdesk-contact.js`) is a complete same-origin page.
49
53
 
50
54
  Telegram is optional and off by default: notifications go by mail to SystemAdmins only. An app
51
55
  that turns it on (`telegram: true`) also mounts `channel-telegram` and `secrets` for the bot
@@ -5,8 +5,10 @@
5
5
  // captcha: honeypot field, single-use proof-of-work challenge, minimum submit time, per-IP
6
6
  // and per-email rate limits. Rejected submits answer 200 with the normal body.
7
7
  //
8
- // The website embeds the anonymous client the feature serves itself:
9
- // <script src="https://api.example.com/helpdesk/client.js"></script>
8
+ // The website embeds the anonymous client the feature serves itself. The client posts to the
9
+ // relative paths /api/query and /api/write, so the page must share its origin with the app
10
+ // (or forward /api to it on its own origin):
11
+ // <script src="/helpdesk/client.js"></script>
10
12
  // const { kinds, phone } = await window.KumikoHelpdesk.load();
11
13
  // const result = await window.KumikoHelpdesk.submit({ kind, name, email, message, locale });
12
14
  // // result.kind: "sent" | "rate-limited" (retryAfterSeconds) | "failed"
@@ -14,7 +16,8 @@
14
16
  // Prerequisites the app wires itself:
15
17
  // - `anonymousAccess` (defaultTenantId = SYSTEM_TENANT_ID) so the form needs no login
16
18
  // - delivery with a mail channel (channel-telegram only with `telegram: true`, off by default)
17
- // - a file provider, because the entities carry file fields
19
+ // - config, user-data-rights and notes-history (required features)
20
+ // - files with a file provider, because the entities carry file fields
18
21
  // - `kumiko schema generate` for the new tables
19
22
 
20
23
  import { createHelpdeskFeature } from "@cosmicdrift/kumiko-bundled-features/helpdesk";