@stacksjs/defaults 0.75.661 → 0.75.667

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 (35) hide show
  1. package/ai/skills/stacks-actions/SKILL.md +1 -1
  2. package/ai/skills/stacks-auth/SKILL.md +1 -0
  3. package/ai/skills/stacks-composables/SKILL.md +6 -5
  4. package/ai/skills/stacks-dashboard/SKILL.md +2 -2
  5. package/ai/skills/stacks-logging/SKILL.md +5 -1
  6. package/ai/skills/stacks-models/SKILL.md +7 -0
  7. package/ai/skills/stacks-native/CATALOG.md +27 -25
  8. package/ai/skills/stacks-newsletter/SKILL.md +51 -0
  9. package/ai/skills/stacks-payments/SKILL.md +13 -0
  10. package/ai/skills/stacks-scheduler/SKILL.md +10 -0
  11. package/ai/skills/stacks-socials/SKILL.md +20 -2
  12. package/ai/skills/stacks-testing/SKILL.md +11 -0
  13. package/app/Actions/ConfirmSubscriptionAction.ts +53 -0
  14. package/app/Actions/SubscriberEmailAction.ts +123 -40
  15. package/app/Actions/UnsubscribeAction.ts +5 -24
  16. package/app/Actions/form-return.ts +65 -0
  17. package/app/Actions/subscription-page.ts +50 -0
  18. package/app/Mail/SubscriptionConfirmRequest.ts +56 -0
  19. package/app/Mail/SubscriptionConfirmation.ts +46 -6
  20. package/app/Models/FailedJob.ts +1 -1
  21. package/app/Models/Referral.ts +1 -1
  22. package/app/Models/commerce/Auction.ts +2 -2
  23. package/app/Models/commerce/AuctionItem.ts +1 -1
  24. package/app/Models/commerce/Bid.ts +1 -1
  25. package/app/Models/commerce/WaitlistProduct.ts +3 -3
  26. package/ide/vscode/package.json +1 -1
  27. package/package.json +7 -7
  28. package/project/storage/framework/types/src/auth.ts +3 -1
  29. package/resources/assets/scripts/main.ts +5 -6
  30. package/resources/components/Marketing/ComingSoon.stx +3 -101
  31. package/resources/components/Marketing/SubscribeForm.stx +315 -0
  32. package/resources/emails/subscription-confirm.stx +31 -0
  33. package/resources/emails/subscription-confirmation.stx +23 -88
  34. package/routes/dashboard.ts +2 -0
  35. package/scaffold/config/server.ts +141 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-actions
3
- description: Use when working with Stacks server actions - creating actions in app/Actions/, auto-generated API actions from the useApi model trait, the 780 default framework actions (auth, dashboard, commerce, content, deployment, jobs), action request/response handling, or action registration. Covers @stacksjs/actions and storage/framework/defaults/app/Actions/.
3
+ description: Use when working with Stacks server actions - creating actions in app/Actions/, auto-generated API actions from the useApi model trait, the 783 default framework actions (auth, dashboard, commerce, content, deployment, jobs), action request/response handling, or action registration. Covers @stacksjs/actions and storage/framework/defaults/app/Actions/.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -275,6 +275,7 @@ the operation must do both separately.
275
275
  - `Auth.revokeOtherTokens(userId?: number, { exceptTokenId? }): Promise<{ keptTokenId: number | null }>` - keeps `exceptTokenId`, else the request's own token; when neither resolves it revokes every token (fail closed)
276
276
  - `Auth.pruneExpiredTokens(): Promise<number>`
277
277
  - `Auth.pruneRevokedTokens(): Promise<number>`
278
+ - The scheduler runs `auth/prune` daily by default (expired tokens, revoked ones older than 7 days); `pruneTokens: false` in config/auth.ts turns it off. `tokenRotation` is read by nothing, and the scheduler warns when it is set.
278
279
  - `Auth.rotateToken(oldToken: string): Promise<AuthToken | null>`
279
280
  - `Auth.findToken(tokenId: number): Promise<PersonalAccessToken | null>`
280
281
 
@@ -31,11 +31,12 @@ compiler-delivered client surface.
31
31
  `browser-auto-imports.json`: that manifest is compile-time only, and 22 of
32
32
  the 27 `use*` it declares are absent from the runtime. -->
33
33
 
34
- `useAsync`, `useClickOutside`, `useColorMode`, `useCounter`, `useDark`,
35
- `useDebounce`, `useDebouncedValue`, `useEventListener`, `useFetch`, `useFocus`,
36
- `useHead`, `useInterval`, `useLocalStorage`, `useMutation`, `useQuery`,
37
- `useRef`, `useRoute`, `useSearchParams`, `useSeoMeta`, `useSessionStorage`,
38
- `useStore`, `useThrottle`, `useTimeout`, `useToggle`, `useWebSocket`.
34
+ `useAsync`, `useAsyncData`, `useClickOutside`, `useColorMode`, `useCounter`,
35
+ `useDark`, `useDebounce`, `useDebouncedValue`, `useEventListener`, `useFetch`,
36
+ `useFocus`, `useHead`, `useInterval`, `useLocalStorage`, `useMutation`,
37
+ `useQuery`, `useRef`, `useRoute`, `useSearchParams`, `useSeoMeta`,
38
+ `useSessionStorage`, `useStore`, `useThrottle`, `useTimeout`, `useToggle`,
39
+ `useWebSocket`.
39
40
 
40
41
  <!-- auto-imported:end -->
41
42
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-dashboard
3
- description: Use when building or customizing the Stacks admin dashboard, including dashboard pages, model management views, analytics widgets, commerce dashboards, content management, settings panels, deployment monitoring, job/queue management, or the 445 built-in dashboard components. Covers the dashboard system at storage/framework/defaults/.
3
+ description: Use when building or customizing the Stacks admin dashboard, including dashboard pages, model management views, analytics widgets, commerce dashboards, content management, settings panels, deployment monitoring, job/queue management, or the 446 built-in dashboard components. Covers the dashboard system at storage/framework/defaults/.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -8,7 +8,7 @@ allowed-tools: Read Edit Write Bash Grep Glob
8
8
 
9
9
  # Stacks Dashboard
10
10
 
11
- The Stacks admin dashboard provides a full-featured admin panel with 100+ route views, 445 components, and a multi-section layout.
11
+ The Stacks admin dashboard provides a full-featured admin panel with 100+ route views, 446 components, and a multi-section layout.
12
12
 
13
13
  ## Key Paths
14
14
  - Dashboard components: `storage/framework/defaults/resources/components/Dashboard/`
@@ -53,7 +53,11 @@ format/file-writing options. Read config/logging.ts rather than inventing a
53
53
  separate severity vocabulary from another logger.
54
54
 
55
55
  Default local logs live under storage/logs; selected file paths and runtime
56
- fallbacks come from the logger/config. The Log model does not automatically make
56
+ fallbacks come from the logger/config. Daily files (`stacks-YYYY-MM-DD.log`)
57
+ are kept for `retentionDays` in config/logging.ts (default 14, `0` keeps every
58
+ file, LOG_RETENTION_DAYS overrides it); older ones are deleted when the logger
59
+ starts and once a day after, and `stacks.log` and other files there are left
60
+ alone. `pruneDailyLogs(directory, days)` runs the same pass on demand. The Log model does not automatically make
57
61
  every log call a database insert. normalizeError/normalizeContext retain embedded
58
62
  Error detail and bound cause traversal; they are not secret redaction policies.
59
63
 
@@ -104,6 +104,13 @@ of forcing a cast. See `orm/tests/inference-attributes.test-d.ts`.
104
104
  | `validation` | `{ rule, message? }` - declared rules are enforced on direct ORM writes and generated CRUD |
105
105
  | `encrypted` | Encrypt persisted values and decrypt model reads; raw queries still see stored ciphertext |
106
106
 
107
+ `encrypted` applies to the model's own writes and reads only. A write through the
108
+ query builder (`db.insertInto(table).values(row)`) is not encrypted on its own: wrap
109
+ the row with `encryptRow(table, row)`, and decrypt query-builder reads with
110
+ `decryptRow(table, row)` / `decryptRows(table, rows)`, all from `@stacksjs/orm`.
111
+ They take column or attribute names, are idempotent, and throw for a table no loaded
112
+ model defines; `encryptedColumns(table)` lists a table's encrypted columns.
113
+
107
114
  ### Traits
108
115
 
109
116
  | Trait | What it adds |
@@ -11,7 +11,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
11
11
  | Package | Task guidance | Source entry | Retained tests |
12
12
  |---|---|---|---|
13
13
  | `@stacksjs/action-runner` | [`stacks-actions`](../stacks-actions/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/action-runner/src/index.ts) | 1 |
14
- | `@stacksjs/actions` | [`stacks-actions`](../stacks-actions/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/index.ts) | 129 |
14
+ | `@stacksjs/actions` | [`stacks-actions`](../stacks-actions/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/index.ts) | 130 |
15
15
  | `@stacksjs/ai` | [`stacks-ai`](../stacks-ai/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/ai/src/index.ts) | 27 |
16
16
  | `@stacksjs/alias` | [`stacks-alias`](../stacks-alias/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/alias/src/index.ts) | 3 |
17
17
  | `@stacksjs/analytics` | [`stacks-analytics`](../stacks-analytics/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/analytics/src/index.ts) | 7 |
@@ -21,7 +21,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
21
21
  | `@stacksjs/auth` | [`stacks-auth`](../stacks-auth/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/index.ts) | 136 |
22
22
  | `@stacksjs/browser` | [`stacks-browser`](../stacks-browser/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/index.ts) | 10 |
23
23
  | `@stacksjs/browser-extension` | [`stacks-browser-extension`](../stacks-browser-extension/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser-extension/src/index.ts) | 9 |
24
- | `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) | 219 |
24
+ | `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) | 220 |
25
25
  | `@stacksjs/build` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/build/src/index.ts) | 7 |
26
26
  | `@stacksjs/cache` | [`stacks-cache`](../stacks-cache/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/cache/src/index.ts) | 24 |
27
27
  | `@stacksjs/calendar-api` | [`stacks-calendar`](../stacks-calendar/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/calendar-api/src/index.ts) | 5 |
@@ -35,11 +35,11 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
35
35
  | `@stacksjs/composables` | [`stacks-composables`](../stacks-composables/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/composables/src/index.ts) | 18 |
36
36
  | `@stacksjs/config` | [`stacks-config`](../stacks-config/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/config/src/index.ts) | 18 |
37
37
  | `@stacksjs/cron` | [`stacks-cron`](../stacks-cron/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/cron/src/index.ts) | 6 |
38
- | `@stacksjs/database` | [`stacks-database`](../stacks-database/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index.ts) | 149 |
38
+ | `@stacksjs/database` | [`stacks-database`](../stacks-database/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index.ts) | 151 |
39
39
  | `@stacksjs/datetime` | [`stacks-datetime`](../stacks-datetime/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/datetime/src/index.ts) | 22 |
40
40
  | `@stacksjs/defaults` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/defaults/package.json) | 3 |
41
41
  | `@stacksjs/deploy` | [`stacks-deploy`](../stacks-deploy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/deploy/package.json) | 1 |
42
- | `@stacksjs/desktop-build` | [`stacks-desktop`](../stacks-desktop/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/index.ts) | 23 |
42
+ | `@stacksjs/desktop-build` | [`stacks-desktop`](../stacks-desktop/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/index.ts) | 24 |
43
43
  | `@stacksjs/development` | [`stacks-development`](../stacks-development/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/development/package.json) | 1 |
44
44
  | `@stacksjs/dns` | [`stacks-dns`](../stacks-dns/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/dns/src/index.ts) | 4 |
45
45
  | `@stacksjs/docs` | [`stacks-docs`](../stacks-docs/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/docs/src/index.ts) | 8 |
@@ -60,16 +60,16 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
60
60
  | `@stacksjs/i18n` | [`stacks-i18n`](../stacks-i18n/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/i18n/src/index.ts) | 7 |
61
61
  | `@stacksjs/image` | [`stacks-image`](../stacks-image/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/image/src/index.ts) | 5 |
62
62
  | `@stacksjs/lint` | [`stacks-lint`](../stacks-lint/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/lint/src/index.ts) | 3 |
63
- | `@stacksjs/logging` | [`stacks-logging`](../stacks-logging/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/logging/src/index.ts) | 14 |
63
+ | `@stacksjs/logging` | [`stacks-logging`](../stacks-logging/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/logging/src/index.ts) | 15 |
64
64
  | `@stacksjs/mobile` | [`stacks-mobile`](../stacks-mobile/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/mobile/src/index.ts) | 23 |
65
65
  | `@stacksjs/model-meta` | [`stacks-models`](../stacks-models/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/model-meta/src/index.ts) | 1 |
66
- | `@stacksjs/newsletter` | [`stacks-newsletter`](../stacks-newsletter/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/index.ts) | 10 |
66
+ | `@stacksjs/newsletter` | [`stacks-newsletter`](../stacks-newsletter/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/index.ts) | 11 |
67
67
  | `@stacksjs/notifications` | [`stacks-notifications`](../stacks-notifications/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/notifications/src/index.ts) | 18 |
68
68
  | `@stacksjs/objects` | [`stacks-objects`](../stacks-objects/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/objects/src/index.ts) | 10 |
69
- | `@stacksjs/orm` | [`stacks-orm`](../stacks-orm/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/index.ts) | 80 |
69
+ | `@stacksjs/orm` | [`stacks-orm`](../stacks-orm/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/index.ts) | 81 |
70
70
  | `@stacksjs/pagination` | [`stacks-pagination`](../stacks-pagination/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/pagination/src/index.ts) | 1 |
71
71
  | `@stacksjs/path` | [`stacks-path`](../stacks-path/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/path/src/index.ts) | 14 |
72
- | `@stacksjs/payments` | [`stacks-payments`](../stacks-payments/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/index.ts) | 40 |
72
+ | `@stacksjs/payments` | [`stacks-payments`](../stacks-payments/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/index.ts) | 42 |
73
73
  | `@stacksjs/push` | [`stacks-push`](../stacks-push/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/push/src/index.ts) | 8 |
74
74
  | `@stacksjs/query-builder` | [`stacks-query-builder`](../stacks-query-builder/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/query-builder/src/index.ts) | 7 |
75
75
  | `@stacksjs/queue` | [`stacks-queue`](../stacks-queue/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/queue/src/index.ts) | 59 |
@@ -77,7 +77,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
77
77
  | `@stacksjs/registry` | [`stacks-registry`](../stacks-registry/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/registry/src/index.ts) | 1 |
78
78
  | `@stacksjs/repl` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/repl/src/index.ts) | 2 |
79
79
  | `@stacksjs/router` | [`stacks-router`](../stacks-router/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/router/src/index.ts) | 114 |
80
- | `@stacksjs/scheduler` | [`stacks-scheduler`](../stacks-scheduler/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/scheduler/src/index.ts) | 19 |
80
+ | `@stacksjs/scheduler` | [`stacks-scheduler`](../stacks-scheduler/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/scheduler/src/index.ts) | 21 |
81
81
  | `@stacksjs/search-engine` | [`stacks-search-engine`](../stacks-search-engine/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/search-engine/src/index.ts) | 11 |
82
82
  | `@stacksjs/security` | [`stacks-security`](../stacks-security/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/security/src/index.ts) | 12 |
83
83
  | `@stacksjs/server` | [`stacks-server`](../stacks-server/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/server/src/index.ts) | 30 |
@@ -86,12 +86,12 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
86
86
  | `@stacksjs/skills` | [`stacks-skills`](../stacks-skills/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/skills/src/index.ts) | 1 |
87
87
  | `@stacksjs/slug` | [`stacks-slug`](../stacks-slug/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/slug/src/index.ts) | 5 |
88
88
  | `@stacksjs/sms` | [`stacks-sms`](../stacks-sms/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/sms/src/index.ts) | 7 |
89
- | `@stacksjs/socials` | [`stacks-socials`](../stacks-socials/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/index.ts) | 18 |
89
+ | `@stacksjs/socials` | [`stacks-socials`](../stacks-socials/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/index.ts) | 21 |
90
90
  | `@stacksjs/storage` | [`stacks-storage`](../stacks-storage/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/index.ts) | 52 |
91
91
  | `@stacksjs/strings` | [`stacks-strings`](../stacks-strings/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/src/index.ts) | 12 |
92
92
  | `@stacksjs/support` | [`stacks-support`](../stacks-support/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/support/src/index.ts) | 6 |
93
93
  | `@stacksjs/telephony` | [`stacks-telephony`](../stacks-telephony/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/telephony/src/index.ts) | 5 |
94
- | `@stacksjs/testing` | [`stacks-testing`](../stacks-testing/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/index.ts) | 27 |
94
+ | `@stacksjs/testing` | [`stacks-testing`](../stacks-testing/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/index.ts) | 28 |
95
95
  | `@stacksjs/tinker` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/index.ts) | 4 |
96
96
  | `@stacksjs/tunnel` | [`stacks-tunnel`](../stacks-tunnel/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tunnel/src/index.ts) | 1 |
97
97
  | `@stacksjs/types` | [`stacks-types`](../stacks-types/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/types/src/index.ts) | 3 |
@@ -123,7 +123,7 @@ Declared runtime exports: `BlogAdminError`, `DEFAULT_IOS_DEPENDENCIES`, `DEFAULT
123
123
 
124
124
  Local source modules: [src/action.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/action.ts), [src/add.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/add.ts), [src/blog-admin.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/blog-admin.ts), [src/build/ios-toolchain.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/build/ios-toolchain.ts), [src/build/macos-native.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/build/macos-native.ts), [src/commit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/commit.ts), [src/dev/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/dev/index.ts), [src/discover-packages.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/discover-packages.ts), [src/generate/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/generate/index.ts), [src/github-release.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/github-release.ts), [src/helpers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/helpers/index.ts), [src/library/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/library/index.ts), [src/lint/lint.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/lint/lint.ts), [src/lint/stx-gate.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/lint/stx-gate.ts), [src/make-command.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-command.ts), [src/make-job.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-job.ts), [src/make-policy.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-policy.ts), [src/make-resource.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make-resource.ts), [src/make.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/make.ts), [src/publication-preflight.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/publication-preflight.ts), [src/release-evidence.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/release-evidence.ts), [src/reviewos-evidence.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/reviewos-evidence.ts), [src/reviewos-workflows.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/reviewos-workflows.ts), [src/scaffold-crud.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/scaffold-crud.ts), [src/setup/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/setup/index.ts), [src/stacks.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/stacks.ts), [src/stx-source.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/stx-source.ts), [src/upgrade/package-project.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/upgrade/package-project.ts), [src/upgrade/route-actions.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/src/upgrade/route-actions.ts).
125
125
 
126
- Evidence directory: [129 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
126
+ Evidence directory: [130 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/actions/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
127
127
 
128
128
  ### @stacksjs/ai
129
129
 
@@ -223,7 +223,7 @@ Read the entrypoint and package export map for re-exported or type-only surfaces
223
223
 
224
224
  Local source modules: [src/commands/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/commands/index.ts).
225
225
 
226
- Evidence directory: [219 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
226
+ Evidence directory: [220 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
227
227
 
228
228
  ### @stacksjs/build
229
229
 
@@ -361,7 +361,7 @@ Declared runtime exports: `Database`, `EntityQueryBuilder`, `__flushAfterCommitN
361
361
 
362
362
  Local source modules: [src/affected-rows.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/affected-rows.ts), [src/auth-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/auth-tables.ts), [src/custom/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/custom/index.ts), [src/database.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/database.ts), [src/datetime-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/datetime-columns.ts), [src/ddl-constraints.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/ddl-constraints.ts), [src/defaults.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/defaults.ts), [src/dialect.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/dialect.ts), [src/driver-config.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/driver-config.ts), [src/drivers/dynamodb.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/drivers/dynamodb.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/drivers/index.ts), [src/ensure-database.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/ensure-database.ts), [src/erd.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/erd.ts), [src/fk-audit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/fk-audit.ts), [src/framework-renames.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/framework-renames.ts), [src/framework-route-admission.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/framework-route-admission.ts), [src/hand-written-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/hand-written-migrations.ts), [src/held-back-changes.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/held-back-changes.ts), [src/ignored-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/ignored-migrations.ts), [src/index-shape.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/index-shape.ts), [src/managed-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/managed-columns.ts), [src/migration-dialect.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-dialect.ts), [src/migration-ledger.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-ledger.ts), [src/migration-names.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-names.ts), [src/migration-path.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migration-path.ts), [src/migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/migrations.ts), [src/model-sources.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/model-sources.ts), [src/notification-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/notification-tables.ts), [src/package-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/package-migrations.ts), [src/package-models.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/package-models.ts), [src/query-logger.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/query-logger.ts), [src/rbac-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/rbac-tables.ts), [src/relation-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/relation-columns.ts), [src/replicas.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/replicas.ts), [src/row-lease.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/row-lease.ts), [src/row-lock.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/row-lock.ts), [src/safe-migrations.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/safe-migrations.ts), [src/schema-align.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/schema-align.ts), [src/schema-drift.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/schema-drift.ts), [src/seeder.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/seeder.ts), [src/shadowed-models.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/shadowed-models.ts), [src/sql-helpers.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/sql-helpers.ts), [src/table-exists.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/table-exists.ts), [src/trait-tables.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/trait-tables.ts), [src/transaction-context.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/transaction-context.ts), [src/transaction-options.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/transaction-options.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/types.ts), [src/unique-audit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/unique-audit.ts), [src/utc-defaults.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/utc-defaults.ts), [src/utils.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/utils.ts), [src/uuid-columns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/uuid-columns.ts), [src/vschema.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/src/vschema.ts).
363
363
 
364
- Evidence directory: [149 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
364
+ Evidence directory: [151 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/database/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
365
365
 
366
366
  ### @stacksjs/datetime
367
367
 
@@ -397,7 +397,7 @@ Declared runtime exports: `BUN_EXECUTABLE_MARKER`, `RESERVED_PLIST_KEYS`, `USERL
397
397
 
398
398
  Local source modules: [src/agent-launcher.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/agent-launcher.ts), [src/agent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/agent.ts), [src/craft-runtime.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/craft-runtime.ts), [src/invites.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/invites.ts), [src/macos-app.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-app.ts), [src/macos-bundle.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-bundle.ts), [src/macos-release.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/macos-release.ts), [src/support.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/support.ts), [src/update-feed.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-feed.ts), [src/update-install.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-install.ts), [src/update-signing.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/update-signing.ts), [src/updater.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/updater.ts), [src/webview-agent.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-agent.ts), [src/webview-app.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-app.ts), [src/webview-build-record.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-build-record.ts), [src/webview-launcher.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/src/webview-launcher.ts).
399
399
 
400
- Evidence directory: [23 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
400
+ Evidence directory: [24 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/desktop/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
401
401
 
402
402
  ### @stacksjs/development
403
403
 
@@ -595,9 +595,11 @@ Evidence directory: [3 retained tests](https://github.com/stacksjs/stacks/blob/m
595
595
 
596
596
  Guidance: [`stacks-logging`](../stacks-logging/SKILL.md). Source: [storage/framework/core/logging/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/logging/src/index.ts).
597
597
 
598
- Declared runtime exports: `currentLevel`, `dd`, `defaultLogDirectory`, `dump`, `echo`, `formatMessage`, `getLogContext`, `log`, `logger`, `normalizeContext`, `normalizeError`, `parseLogFormat`, `parseLogLevel`, `registerTransport`, `renderNormalizedError`, `report`, `resolveLogSettings`, `struct`, `suppressedAtCurrentLevel`, `transports`, `withLogContext`.
598
+ Declared runtime exports: `DEFAULT_LOG_RETENTION_DAYS`, `currentLevel`, `dd`, `defaultLogDirectory`, `dump`, `echo`, `formatMessage`, `getLogContext`, `log`, `logger`, `normalizeContext`, `normalizeError`, `parseLogFormat`, `parseLogLevel`, `pruneDailyLogs`, `registerTransport`, `renderNormalizedError`, `report`, `resolveLogSettings`, `struct`, `suppressedAtCurrentLevel`, `transports`, `withLogContext`.
599
599
 
600
- Evidence directory: [14 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/logging/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
600
+ Local source modules: [src/retention.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/logging/src/retention.ts).
601
+
602
+ Evidence directory: [15 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/logging/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
601
603
 
602
604
  ### @stacksjs/mobile
603
605
 
@@ -625,7 +627,7 @@ Read the entrypoint and package export map for re-exported or type-only surfaces
625
627
 
626
628
  Local source modules: [src/campaigns.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/campaigns.ts), [src/delivery.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/delivery.ts), [src/headers.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/headers.ts), [src/lists.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/lists.ts), [src/newsletter.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/newsletter.ts), [src/subscriptions.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/subscriptions.ts), [src/sync.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/sync.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/types.ts), [src/usage.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/src/usage.ts).
627
629
 
628
- Evidence directory: [10 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
630
+ Evidence directory: [11 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/newsletter/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
629
631
 
630
632
  ### @stacksjs/notifications
631
633
 
@@ -651,11 +653,11 @@ Evidence directory: [10 retained tests](https://github.com/stacksjs/stacks/blob/
651
653
 
652
654
  Guidance: [`stacks-orm`](../stacks-orm/SKILL.md). Source: [storage/framework/core/orm/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/index.ts).
653
655
 
654
- Declared runtime exports: `Activity`, `AnalyticsEvent`, `Auction`, `AuctionItem`, `Author`, `Automation`, `AutomationRun`, `BILLABLE_INSTANCE_METHODS`, `Bid`, `Board`, `BoardColumn`, `Campaign`, `CampaignSend`, `CampaignVariant`, `Card`, `CardAttachment`, `CardComment`, `Cart`, `CartItem`, `Categorizable`, `Category`, `Comment`, `CommunicationSuppression`, `ConsentEvent`, `Coupon`, `Courier`, `CourierPing`, `Customer`, `DeliveryRoute`, `DeliveryStop`, `Deployment`, `DigitalDelivery`, `Discount`, `EmailIdempotency`, `EmailList`, `EmailListSubscriber`, `EmailSuppression`, `EmailWebhookEvent`, `ErrorModel`, `FailedJob`, `FeedbackToken`, `Form`, `FormField`, `FormSubmission`, `GdprRequest`, `GiftCard`, `Job`, `Label`, `LicenseActivation`, `LicenseKey`, `LicenseSeat`, `Log`, `LoyaltyPoint`, `LoyaltyReward`, `MagicLinkToken`, `MailPreference`, `Manufacturer`, `Menu`, `MenuItem`, `ModelUnavailableError`, `Notification`, `NotificationDelivery`, `Order`, `OrderIdempotency`, `OrderItem`, `Page`, `PageRevision`, `Payment`, `PaymentMethod`, `PaymentProduct`, `PaymentTransaction`, `PaymentWebhookEvent`, `PersonalAccessToken`, `Pledge`, `Post`, `PostPurchaseOffer`, `PostPurchaseOfferResponse`, `PrintDevice`, `Product`, `ProductUnit`, `ProductVariant`, `QueryLog`, `QueueWorker`, `Receipt`, `Redirect`, `Referral`, `ReferralCode`, `Release`, `Request`, `Review`, `SenderDomain`, `ShippingMethod`, `ShippingRate`, `ShippingZone`, `Site`, `SiteDomain`, `SmsOptOut`, `SocialAccount`, `SocialPost`, `StorageItem`, `StorageItemTask`, `Subscriber`, `SubscriberEmail`, `Subscription`, `SubscriptionNotOwnedError`, `Tag`, `TaxRate`, `Team`, `TeamInvitation`, `TeamMember`, `Transaction`, `UsageEvent`, `User`, `WaitlistProduct`, `WaitlistRestaurant`, `Websocket`, `buildDatabaseSchema`, `collectEncryptedAttributes`, `createAuditMethods`, `createCategorizableMethods`, `createCommentableMethods`, `createLikeableMethods`, `createTaggableMethods`, `customerOwnership`, `decryptValue`, `decryptValueInPlace`, `encryptValue`, `enrichPaginatorUrls`, `filterFillable`, `frameworkModelFeature`, `getWritableFields`, `isBillable`, `isCursorPaginator`, `isEncrypted`, `isPaginator`, `isSimplePaginator`, `isUniqueViolation`, `mapWriteError`, `modelGlobalNames`, `ormReady`, `parentOwnership`, `parseCursor`, `renderDatabaseTypeFile`, `resolveCursorArgs`, `resolvePageArgs`, `selfOwnership`, `setAuditUser`, `siteOwnership`, `teamMembershipOwnership`, `toCursorPaginator`, `toPaginator`, `toSimplePaginator`, `toSnakeCaseKeys`.
656
+ Declared runtime exports: `Activity`, `AnalyticsEvent`, `Auction`, `AuctionItem`, `Author`, `Automation`, `AutomationRun`, `BILLABLE_INSTANCE_METHODS`, `Bid`, `Board`, `BoardColumn`, `Campaign`, `CampaignSend`, `CampaignVariant`, `Card`, `CardAttachment`, `CardComment`, `Cart`, `CartItem`, `Categorizable`, `Category`, `Comment`, `CommunicationSuppression`, `ConsentEvent`, `Coupon`, `Courier`, `CourierPing`, `Customer`, `DeliveryRoute`, `DeliveryStop`, `Deployment`, `DigitalDelivery`, `Discount`, `EmailIdempotency`, `EmailList`, `EmailListSubscriber`, `EmailSuppression`, `EmailWebhookEvent`, `ErrorModel`, `FailedJob`, `FeedbackToken`, `Form`, `FormField`, `FormSubmission`, `GdprRequest`, `GiftCard`, `Job`, `Label`, `LicenseActivation`, `LicenseKey`, `LicenseSeat`, `Log`, `LoyaltyPoint`, `LoyaltyReward`, `MagicLinkToken`, `MailPreference`, `Manufacturer`, `Menu`, `MenuItem`, `ModelUnavailableError`, `Notification`, `NotificationDelivery`, `Order`, `OrderIdempotency`, `OrderItem`, `Page`, `PageRevision`, `Payment`, `PaymentMethod`, `PaymentProduct`, `PaymentTransaction`, `PaymentWebhookEvent`, `PersonalAccessToken`, `Pledge`, `Post`, `PostPurchaseOffer`, `PostPurchaseOfferResponse`, `PrintDevice`, `Product`, `ProductUnit`, `ProductVariant`, `QueryLog`, `QueueWorker`, `Receipt`, `Redirect`, `Referral`, `ReferralCode`, `Release`, `Request`, `Review`, `SenderDomain`, `ShippingMethod`, `ShippingRate`, `ShippingZone`, `Site`, `SiteDomain`, `SmsOptOut`, `SocialAccount`, `SocialPost`, `StorageItem`, `StorageItemTask`, `Subscriber`, `SubscriberEmail`, `Subscription`, `SubscriptionNotOwnedError`, `Tag`, `TaxRate`, `Team`, `TeamInvitation`, `TeamMember`, `Transaction`, `UsageEvent`, `User`, `WaitlistProduct`, `WaitlistRestaurant`, `Websocket`, `buildDatabaseSchema`, `collectEncryptedAttributes`, `createAuditMethods`, `createCategorizableMethods`, `createCommentableMethods`, `createLikeableMethods`, `createTaggableMethods`, `customerOwnership`, `decryptRow`, `decryptRows`, `decryptValue`, `decryptValueInPlace`, `encryptRow`, `encryptValue`, `encryptedColumns`, `enrichPaginatorUrls`, `filterFillable`, `frameworkModelFeature`, `getWritableFields`, `isBillable`, `isCursorPaginator`, `isEncrypted`, `isPaginator`, `isSimplePaginator`, `isUniqueViolation`, `mapWriteError`, `modelGlobalNames`, `ormReady`, `parentOwnership`, `parseCursor`, `renderDatabaseTypeFile`, `resolveCursorArgs`, `resolvePageArgs`, `selfOwnership`, `setAuditUser`, `siteOwnership`, `teamMembershipOwnership`, `toCursorPaginator`, `toPaginator`, `toSimplePaginator`, `toSnakeCaseKeys`.
655
657
 
656
658
  Local source modules: [src/auto-crud.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/auto-crud.ts), [src/batch-loader.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/batch-loader.ts), [src/db.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/db.ts), [src/define-model.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/define-model.ts), [src/extend-model.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/extend-model.ts), [src/gdpr/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/gdpr/index.ts), [src/generate-database-schema.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/generate-database-schema.ts), [src/locked-row.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/locked-row.ts), [src/messaging.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/messaging.ts), [src/model-types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/model-types.ts), [src/ownership.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/ownership.ts), [src/paginator-request.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/paginator-request.ts), [src/row-token.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/row-token.ts), [src/subquery.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/subquery.ts), [src/traits/audit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/audit.ts), [src/traits/billable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/billable.ts), [src/traits/categorizable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/categorizable.ts), [src/traits/commentable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/commentable.ts), [src/traits/likeable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/likeable.ts), [src/traits/taggable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/traits/taggable.ts), [src/transaction.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/transaction.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/types.ts), [src/utils/encrypted.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/utils/encrypted.ts), [src/utils/prunable.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/src/utils/prunable.ts).
657
659
 
658
- Evidence directory: [80 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
660
+ Evidence directory: [81 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/orm/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
659
661
 
660
662
  ### @stacksjs/pagination
661
663
 
@@ -683,7 +685,7 @@ Declared runtime exports: `Payment`, `freshIdempotencyKey`, `stacksIdempotencyKe
683
685
 
684
686
  Local source modules: [src/billable/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/billable/index.ts), [src/checkout-outcome.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/checkout-outcome.ts), [src/connect/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/connect/index.ts), [src/direct-debit.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/direct-debit.ts), [src/driver/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/driver/index.ts), [src/drivers/stripe.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/drivers/stripe.ts), [src/idempotency.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/idempotency.ts), [src/payment.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/payment.ts), [src/subscription-state.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/subscription-state.ts), [src/terminal.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/src/terminal.ts).
685
687
 
686
- Evidence directory: [40 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
688
+ Evidence directory: [42 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/payments/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
687
689
 
688
690
  ### @stacksjs/push
689
691
 
@@ -759,7 +761,7 @@ Read the entrypoint and package export map for re-exported or type-only surfaces
759
761
 
760
762
  Local source modules: [src/run.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/scheduler/src/run.ts), [src/schedule.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/scheduler/src/schedule.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/scheduler/src/types.ts).
761
763
 
762
- Evidence directory: [19 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/scheduler/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
764
+ Evidence directory: [21 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/scheduler/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
763
765
 
764
766
  ### @stacksjs/search-engine
765
767
 
@@ -845,9 +847,9 @@ Guidance: [`stacks-socials`](../stacks-socials/SKILL.md). Source: [storage/frame
845
847
 
846
848
  Read the entrypoint and package export map for re-exported or type-only surfaces.
847
849
 
848
- Local source modules: [src/abstract.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/abstract.ts), [src/authorize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/authorize.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/drivers/index.ts), [src/exceptions.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/exceptions.ts), [src/flows.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/flows.ts), [src/handoff.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/handoff.ts), [src/identities.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/identities.ts), [src/meta-graph.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/meta-graph.ts), [src/publish.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/publish.ts), [src/registry.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/registry.ts), [src/token.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/token.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/types.ts).
850
+ Local source modules: [src/abstract.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/abstract.ts), [src/authorize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/authorize.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/drivers/index.ts), [src/exceptions.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/exceptions.ts), [src/flows.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/flows.ts), [src/handoff.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/handoff.ts), [src/identities.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/identities.ts), [src/media.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/media.ts), [src/meta-graph.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/meta-graph.ts), [src/publish-errors.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/publish-errors.ts), [src/publish.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/publish.ts), [src/registry.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/registry.ts), [src/text.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/text.ts), [src/token.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/token.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/types.ts).
849
851
 
850
- Evidence directory: [18 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
852
+ Evidence directory: [21 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
851
853
 
852
854
  ### @stacksjs/storage
853
855
 
@@ -897,7 +899,7 @@ Read the entrypoint and package export map for re-exported or type-only surfaces
897
899
 
898
900
  Local source modules: [src/console.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/console.ts), [src/disposable-database.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/disposable-database.ts), [src/events.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/events.ts), [src/feature.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/feature.ts), [src/isolated.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/isolated.ts), [src/mail.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/mail.ts), [src/schema.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/schema.ts), [src/service.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/service.ts), [src/time.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/time.ts).
899
901
 
900
- Evidence directory: [27 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
902
+ Evidence directory: [28 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
901
903
 
902
904
  ### @stacksjs/tinker
903
905
 
@@ -26,6 +26,57 @@ before that still match. A sync skips an address whose row on the list is
26
26
  unsubscribed under any spelling. subscriberIdsForEmail(email) and
27
27
  listStatusForEmail(email, listId) are the lookups they share.
28
28
 
29
+ ## Public signup
30
+
31
+ Put `<SubscribeForm />` on a page for a newsletter signup; it ships in the
32
+ framework defaults (`resources/components/Marketing/SubscribeForm.stx`) and
33
+ needs no setup. It is an stx component: it submits in place with a spinner and
34
+ shows the answer under the field, and without JavaScript it still posts as a
35
+ plain form. Props are all optional: `list` (a public list's slug, else the
36
+ default list), `source`, `label`, `placeholder`, `intro`, `fine`,
37
+ `successText`, `alreadyText`, `tone` (`primary` or `outline`), `buttonClass`,
38
+ `returnTo`, and `outcome`. A plain post comes back with `?subscribe=<outcome>`;
39
+ pass it to `outcome` so the page shows the answer on load. Restyle it with the
40
+ `--subscribe-*` CSS variables or your own classes; its rules have zero
41
+ specificity.
42
+
43
+ The form posts to `POST /api/email/subscribe` (`SubscriberEmailAction`), which
44
+ goes through `subscribe(email, { list, source, publicOnly: true })`: the
45
+ signup joins a list, so campaigns reach it. `publicOnly` refuses a list whose
46
+ `is_public` is false (`NewsletterListUnavailableError`, answered as a 422), so a
47
+ form field never joins an internal list. Outcomes: `subscribed` (new, or a
48
+ returning opt-out signed back up), `already`, `invalid`, `busy` (rate limited)
49
+ and `error`. Scripts get JSON; a browser form post gets a 303 back to `return`
50
+ or the Referer. The welcome email carries the membership's own token, so its
51
+ unsubscribe link and RFC 8058 headers leave that list only.
52
+
53
+ `subscribe()` validates with `emailAddress()` and reports `created`,
54
+ `reactivated` (signed back up after a per-list or global opt-out),
55
+ `subscriberId` and `token`. The legacy global unsubscribe link (a subscriber
56
+ uuid) also unsubscribes every list membership, since campaigns send to
57
+ memberships.
58
+
59
+ ## Double opt-in
60
+
61
+ Turn on `doubleOptIn` for a list (`lists.create({ ..., doubleOptIn: true })`
62
+ or the dashboard) and its public signups confirm their address first. The
63
+ endpoint calls `subscribe()` with `confirmation: 'list'`, so a new or returning
64
+ address on such a list is stored `pending` (the membership, and the person if
65
+ they are new), the `SubscriptionConfirmRequest` mail sends a
66
+ `resources/emails/subscription-confirm.stx` email, and the form answers
67
+ `pending` (`pendingText`). Its button opens `GET /api/email/confirm?token=`
68
+ (`ConfirmSubscriptionAction`), which calls `confirm(token)`, stamps
69
+ `subscribed_at`, and sends the welcome email. Campaigns skip pending
70
+ memberships. Signing up again while pending re-sends the email; confirming
71
+ twice is harmless; a token that has since unsubscribed is refused.
72
+
73
+ `subscribe()` without `confirmation: 'list'` (imports, admin adds) subscribes
74
+ at once and promotes a pending membership. The auto-created default list is
75
+ single opt-in. A default list created by an older release has
76
+ `double_opt_in` on; set it off if you do not want confirmation there. The
77
+ confirm and unsubscribe routes stay reachable in maintenance and coming-soon
78
+ mode, like the signup.
79
+
29
80
  Campaign delivery snapshots, dispatch keys and state conflict errors protect
30
81
  retries and concurrent queue requests. Scheduled work uses the package's actual
31
82
  transition and readiness checks. DeliveryVariant allocation and
@@ -102,6 +102,8 @@ const upgrade = await Payment.subscriptionCheckout(user, 'price_xxx', {
102
102
 
103
103
  Send the payer to `session.url`. `trialDays` starts a subscription checkout with a trial. `reference` and `metadata` are copied onto the payment or subscription the checkout creates. Return URLs must be on the app's origin.
104
104
 
105
+ For Stripe checkout, persist an `idempotencyKey` before starting an attempt. Reuse the key and the same parameters when retrying that attempt within Stripe's replay window. Reconcile the original attempt before retrying after the replay window. Omit the key to start a new attempt, or supply a new key if the app needs to retry it safely. The key goes in a Stripe request header. Other built-in drivers reject this option.
106
+
105
107
  ### Subscriptions
106
108
 
107
109
  ```typescript
@@ -706,6 +708,15 @@ portal: {
706
708
  paymentMethodUpdate: true, // default true
707
709
  invoiceHistory: true, // default true
708
710
  emailUpdate: true, // default true
711
+ subscriptionUpdate: {
712
+ allowedUpdates: ['price', 'quantity'],
713
+ prorationBehavior: 'always_invoice',
714
+ products: [{
715
+ product: 'prod_xxx',
716
+ prices: ['price_monthly', 'price_yearly'],
717
+ adjustableQuantity: { minimum: 1, maximum: 20 },
718
+ }],
719
+ },
709
720
  }
710
721
  ```
711
722
 
@@ -714,6 +725,8 @@ and found by that tag, so several apps can share one Stripe account without
714
725
  editing each other's portal. `billingPortal()` uses it, or the account default
715
726
  when the app declares no portal.
716
727
 
728
+ Use Stripe product IDs and price IDs to choose which subscriptions customers can change. Include an `adjustableQuantity` range on each product where customers may change the seat count. Set `subscriptionUpdate: false` to disable the feature. Omit the setting to preserve the portal configuration's existing subscription-update settings.
729
+
717
730
  ### Utility Functions
718
731
 
719
732
  ```typescript
@@ -252,6 +252,14 @@ import { runScheduler } from '@stacksjs/scheduler'
252
252
  const result = await runScheduler()
253
253
  ```
254
254
 
255
+ Last, `runScheduler()` adds the framework's own housekeeping (`maintenance.ts`):
256
+ `auth/prune` (what `buddy auth:prune` does: expired tokens, and revoked ones
257
+ older than 7 days) daily at 03:15, unless the app already schedules
258
+ `auth/prune` itself or `config/auth.ts` sets `pruneTokens: false`. It also warns
259
+ when `config/auth.ts` still sets the dead `tokenRotation`. `buddy dev` starts
260
+ the scheduler only for an app with an app/Scheduler.ts or a job, so an app
261
+ with neither prunes only where `schedule:run` runs.
262
+
255
263
  ## Queue-Level Scheduler (queue/src/scheduler.ts)
256
264
 
257
265
  A separate, queue-integrated scheduler that discovers jobs and dispatches them to the queue system:
@@ -302,6 +310,8 @@ process.on('SIGINT', () => {
302
310
 
303
311
  - `buddy schedule:run` -- Runs `Action.ScheduleRun`, which calls `runScheduler()`
304
312
  - Options: `-p, --project [project]`, `--verbose`
313
+ - `buddy dev` -- Runs the same `Action.ScheduleRun` beside the dev servers whenever the app has an `app/Scheduler.ts` or a job in `app/Jobs/`, and says so in the ready banner. `--no-schedule` or `STACKS_DEV_SCHEDULE=0` turns it off, for an app whose tasks send email or post for real.
314
+ - A process whose only tasks are sub-minute (`everySecond()`) does not stay up: those interval timers are `unref()`'d. A minute-or-longer task keeps it running.
305
315
 
306
316
  ## Code Examples
307
317
 
@@ -117,6 +117,22 @@ through it. PublishPostInput/PublishedPost/SocialPublishingDriver are exported
117
117
  contracts. Read their driver methods before using media, metrics, deletion,
118
118
  refresh or profile functionality; support differs per provider.
119
119
 
120
+ Each driver measures its limit the way its network counts (countText and
121
+ exceedsLimit in text.ts: graphemes on Bluesky and Threads, X's weighted count,
122
+ Mastodon's link and mention rules) and sends several images with alt text: X up
123
+ to four, carousels on Threads and Instagram, multiImage on LinkedIn. An image
124
+ given by URL is downloaded through fetchPostImage (the outbound guard in
125
+ @stacksjs/security) and a URL that gives no image throws PostImageError; tests
126
+ replace a driver's fetchImage. Mastodon's publish takes a third argument
127
+ (idempotencyKey, visibility, spoilerText, language) and reads the instance's
128
+ limits. Bluesky uploads external.thumb for link cards. PublishedPost.warnings
129
+ lists what went out without failing the post. The LinkedIn version is
130
+ LINKEDIN_API_VERSION unless a configured one is still supported.
131
+
132
+ A driver error's isAuthError is narrow; classifySocialError in
133
+ publish-errors.ts sorts any failure by status and body, and only `expired`
134
+ means the account must sign in again (a duplicate post on X is a 403).
135
+
120
136
  ## Authorization and operational limits
121
137
 
122
138
  The native terminal consent helper in authorize.ts currently supports X only.
@@ -133,8 +149,10 @@ conformance or successful publication for arbitrary accounts.
133
149
  ## Source and evidence
134
150
 
135
151
  `storage/framework/core/socials/src/index.ts`, registry.ts, abstract.ts, flows.ts,
136
- handoff.ts, identities.ts, publish.ts, authorize.ts, meta-graph.ts and drivers/.
152
+ handoff.ts, identities.ts, publish.ts, authorize.ts, meta-graph.ts, text.ts,
153
+ media.ts, publish-errors.ts and drivers/.
137
154
  Tests: registry.test.ts, apple.test.ts, session-handoff.test.ts, oauth-flows.test.ts,
138
155
  provider-flow-state.test.ts, auth/tests/social-callback-flow.test.ts,
139
156
  identities.test.ts, publish.test.ts, authorize.test.ts,
140
- credentials-stay-out-of-output.test.ts and meta-graph.test.ts.
157
+ credentials-stay-out-of-output.test.ts, meta-graph.test.ts,
158
+ publishing-drivers.test.ts, text.test.ts and publish-errors.test.ts.
@@ -37,6 +37,17 @@ auto-imported names exist in a test. Without it, loading an action written
37
37
  without imports throws "Action is not defined". `setupTestEnvironment()` still
38
38
  exists and only sets the env.
39
39
 
40
+ For an app suite, `bootTestEnvironment()` also gives the run a throwaway SQLite
41
+ database: a `stacks_test_*.sqlite` file in a temporary directory, set as
42
+ `DB_DATABASE_PATH` before the app's config loads and removed when the run ends.
43
+ `refreshDatabase()` migrates it the first time a test asks. The suite used to run
44
+ against whatever `.env` named, which on a developer's machine is their real data.
45
+ A Postgres or MySQL run keeps its configured database (the reset refuses one whose
46
+ name doesn't say it's for tests), and `STACKS_TEST_DATABASE=configured` keeps a
47
+ configured SQLite file too. The SQLite reset now acts on the connection's own file
48
+ and refuses one the run didn't create, unless it's under the temporary directory or
49
+ named for tests (`app_test.sqlite`).
50
+
40
51
  ```typescript
41
52
  import { refreshDatabase, setupDatabase, truncateMysql, truncatePostgres, truncateSqlite } from '@stacksjs/testing/database'
42
53
 
@@ -0,0 +1,53 @@
1
+ import type { RequestInstance } from '@stacksjs/types'
2
+ import { Action } from '@stacksjs/actions/runtime'
3
+ import { confirm } from '@stacksjs/newsletter'
4
+ import { sendSubscriptionConfirmation } from '../Mail/SubscriptionConfirmation'
5
+ import { subscriptionPage } from './subscription-page'
6
+
7
+ /**
8
+ * `GET /api/email/confirm?token=…`: the button in the double opt-in email.
9
+ *
10
+ * Confirms the pending list membership the token names (@stacksjs/newsletter's
11
+ * `confirm()`), sends the welcome email the first time, and answers with a
12
+ * small page. Confirming twice is harmless. A token that has since
13
+ * unsubscribed is refused, so an old confirmation link never undoes an
14
+ * opt-out.
15
+ */
16
+ export default new Action({
17
+ name: 'ConfirmSubscriptionAction',
18
+ description: 'Confirm a double opt-in newsletter subscription from the emailed link',
19
+ method: 'GET',
20
+
21
+ async handle(request: RequestInstance) {
22
+ const token = String(request.get('token') || '')
23
+ const html = (title: string, message: string, success: boolean) => new Response(subscriptionPage(title, message, success), {
24
+ headers: { 'Content-Type': 'text/html; charset=utf-8' },
25
+ })
26
+
27
+ if (!token)
28
+ return html('Missing token', 'This confirmation link is incomplete. Open it again from the email.', false)
29
+
30
+ try {
31
+ const result = await confirm(token)
32
+
33
+ if (!result.ok)
34
+ return html('Link no longer valid', 'This confirmation link has expired or was already used to unsubscribe. Sign up again to get a fresh one.', false)
35
+
36
+ if (result.alreadyConfirmed)
37
+ return html('Already confirmed', `${result.email ?? 'Your address'} is already subscribed. Nothing else to do.`, true)
38
+
39
+ if (result.email) {
40
+ sendSubscriptionConfirmation({ to: result.email, token }).catch((err: unknown) => {
41
+ const message = err instanceof Error ? err.message : String(err)
42
+ console.error(`Failed to send welcome email to ${result.email}:`, message)
43
+ })
44
+ }
45
+
46
+ return html('You are subscribed', `Thanks for confirming. ${result.email ?? 'Your address'} is on the list, and a welcome email is on its way.`, true)
47
+ }
48
+ catch (error: unknown) {
49
+ console.error('Confirm subscription error:', error instanceof Error ? error.message : String(error))
50
+ return html('Something went wrong', 'We could not confirm your subscription just now. Please try the link again in a moment.', false)
51
+ }
52
+ },
53
+ })