@stacksjs/defaults 0.75.31 → 0.75.33

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.
@@ -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 634 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 647 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
@@ -295,7 +295,7 @@ interface RbacStore { findRoleByName, createRole, deleteRole, getAllRoles, findP
295
295
  - `SessionAuth.check(sessionId): boolean`
296
296
  - `SessionAuth.refresh(sessionId, ttlMs?): boolean`, rejects non-positive or non-finite TTLs without changing the session
297
297
 
298
- Internal: in-memory Map with 10k session limit, 5-minute eviction interval, timing-safe password comparison with dummy bcrypt hash.
298
+ Internal: database-backed `sessions` rows with expiry, optional IP/User-Agent fingerprint checks, transactional logout and refresh, and timing-safe password comparison with a dummy bcrypt hash. Sessions survive process restarts and are shared by workers through the configured database.
299
299
 
300
300
  ## Email Verification (email-verification.ts)
301
301
 
@@ -395,7 +395,6 @@ await authUser.authorize('edit-post', post) // throws if denied
395
395
  withRefreshToken: false, // fixed browser lifetime, no unused refresh token
396
396
  logoutRedirect: '/login?logged_out=1', // local path for HTML logout only
397
397
  },
398
- tokenRotation: 24, // hours
399
398
  defaultAbilities: ['*'],
400
399
  defaultTokenName: 'auth-token',
401
400
  passwordReset: { expire: 60, throttle: 60 }
@@ -505,12 +504,12 @@ traits: {
505
504
 
506
505
  - Auth depends on `@stacksjs/ts-auth` for TOTP and passkey functions
507
506
  - Password hashing defaults to bcrypt with 12 rounds (config/hashing.ts)
508
- - Rate limiter uses in-memory Map, resets on server restart — not shared across workers
509
- - Session auth also uses in-memory Map with 10k limit — for SPA cookie auth
510
- - Token format is `tokenId|plainText` — the `|` separates the encrypted ID from the plain token
511
- - The `parseToken()` helper splits on `|` to extract both parts
507
+ - Rate limiting uses a process-local memory store by default. Production deployments with multiple workers should configure the atomic Redis store or provide a custom atomic store.
508
+ - Session auth is database-backed through the `sessions` table, so it survives server restarts and is shared across workers.
509
+ - New personal and delegated access tokens are opaque 40-byte hex bearers hashed at rest. Legacy `jwt:encryptedId` bearers remain readable during migration.
510
+ - Token validation hashes the bearer directly. Do not parse or expose token contents, and never log plaintext bearer values.
512
511
  - Bearer tokens come from the `Authorization: Bearer <token>` header
513
- - `Auth.user()` internally calls `getBearerToken()` → `parseToken()` → `getTokenFromId()` → validates hash
512
+ - `Auth.user()` internally calls `getBearerToken()` and resolves the bearer through a hashed token lookup
514
513
  - RBAC has an internal cache (`userRoles`, `userPermissions`, `rolePermissions`) — call `Rbac.flushCache()` after direct DB changes
515
514
  - `syncRoles()` and `syncPermissions()` are guard-scoped replacements: they preserve assignments belonging to other guards
516
515
  - Gate `before` callbacks can short-circuit — return `true` to allow, `null` to continue checking
@@ -66,7 +66,7 @@ they name: `defineEvents` and `defineListener` from `@stacksjs/events`,
66
66
  | File | Type | Key Settings |
67
67
  |------|------|-------------|
68
68
  | `app.ts` | AppConfig | name, env, url, debug, key, timezone, locale |
69
- | `auth.ts` | AuthConfig | guards, providers, tokenExpiry(30d), tokenRotation(7d), passwordReset |
69
+ | `auth.ts` | AuthConfig | guards, providers, token and browser-session lifetimes, passwordReset |
70
70
  | `database.ts` | DatabaseConfig | default driver, connections (sqlite/mysql/postgres/dynamodb), queryLogging |
71
71
  | `cache.ts` | CacheConfig | driver('memory'), ttl(3600), maxKeys(-1), redis config |
72
72
  | `env.ts` | EnvConfig | validation schemas for env vars |
@@ -238,6 +238,12 @@ abstract class BaseEmailDriver {
238
238
  }
239
239
  ```
240
240
 
241
+ ### Mail DNS a deploy publishes
242
+
243
+ With `server.enabled`, `buddy deploy` reconciles the mail domain's DNS through whichever configured provider holds the zone: MX, SPF, DKIM at the selector the server signs under, DMARC (`server.dmarc`), `mail.<domain>`, and the Gmail Postmaster Tools verification TXT when `server.postmaster.google` is set. Writes are surgical: only records the deploy owns are replaced, so other apex TXT (Search Console, other verifications) survive.
244
+
245
+ Postmaster Tools is the only view of why Gmail files mail as spam when SPF, DKIM and DMARC all pass. Its value is issued per Google account and cannot be generated: add the domain at https://postmaster.google.com, copy the TXT value, set `server.postmaster.google`, deploy, then press Verify in Postmaster Tools. Until it is set the deploy prints where to get it; `postmaster: false` silences that.
246
+
241
247
  ## Application Mail Example
242
248
 
243
249
  ```typescript
@@ -29,7 +29,7 @@ interface AuthConfig {
29
29
  username: string
30
30
  password: string
31
31
  tokenExpiry: number // 30 days
32
- tokenRotation: number // 7 days
32
+ tokenRotation?: number // deprecated; rotate explicitly
33
33
  defaultAbilities: string[]
34
34
  defaultTokenName: string
35
35
  }
@@ -31,7 +31,9 @@ async function renderConsentView(
31
31
  const { renderTemplate } = await import('@stacksjs/stx')
32
32
 
33
33
  return String(await renderTemplate(template, {
34
- context,
34
+ // Spread into a literal: an interface has no index signature, so it is
35
+ // not a Record<string, unknown> until it becomes an object literal.
36
+ context: { ...context },
35
37
  injectCSS: true,
36
38
  templateOnly: true,
37
39
  processClientScripts: false,
@@ -18,8 +18,12 @@ export default new Action({
18
18
  if (!provider)
19
19
  return response.notFound('OAuth provider is not enabled')
20
20
 
21
+ // Check `user` itself rather than only through `id`, so the workspace
22
+ // resolver below sees a narrowed user instead of `AuthenticatedUser | undefined`.
21
23
  const user = await request.user()
22
- const id = user ? oauthPositiveId(user.id) : null
24
+ if (!user)
25
+ return response.unauthorized('Authentication required')
26
+ const id = oauthPositiveId(user.id)
23
27
  if (!id)
24
28
  return response.unauthorized('Authentication required')
25
29
 
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.31",
5
+ "version": "0.75.33",
6
6
  "description": "A modern Stacks development environment.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.31",
5
+ "version": "0.75.33",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@iconify-json/f7": "^1.2.2",
57
57
  "@iconify-json/hugeicons": "^1.2.27",
58
- "@stacksjs/mobile": "^0.75.31",
58
+ "@stacksjs/mobile": "^0.75.33",
59
59
  "@stacksjs/sanitizer": "^0.2.113",
60
60
  "ts-qr-codes": "^0.1.8"
61
61
  }
@@ -19,7 +19,8 @@ export interface AuthConfig {
19
19
  username: string
20
20
  password: string
21
21
  tokenExpiry: number
22
- tokenRotation: number
22
+ /** @deprecated Use explicit bearer rotation or a refresh-token exchange. */
23
+ tokenRotation?: number
23
24
  defaultAbilities: string[]
24
25
  defaultTokenName: string
25
26
  }