@happyvertical/smrt-users 0.38.22 → 0.38.24
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/AGENTS.md +13 -0
- package/README.md +9 -0
- package/dist/chunks/{TerminalAuthService-XGjoR45J.js → TerminalAuthService-9VB3eLYO.js} +2 -2
- package/dist/chunks/{TerminalAuthService-XGjoR45J.js.map → TerminalAuthService-9VB3eLYO.js.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/manifest.json +2 -2
- package/dist/smrt-knowledge.json +6 -6
- package/dist/sveltekit.js +1 -1
- package/package.json +11 -11
package/AGENTS.md
CHANGED
|
@@ -88,6 +88,16 @@ throw). The default seed leaves every role exact-tenant.
|
|
|
88
88
|
|
|
89
89
|
## Operation Permission Guards
|
|
90
90
|
|
|
91
|
+
SMRT derives a fine-grained, per-`<collection>.<action>` permission catalog **from the
|
|
92
|
+
manifest** (`PermissionCatalogService`, including custom `@smrt` actions — not just CRUD)
|
|
93
|
+
and enforces it two ways: app-side via `assertOperationPermission()` / `PermissionResolver`,
|
|
94
|
+
and at the database via generated **Postgres RLS** policies
|
|
95
|
+
(`generatePostgresPermissionSql()` / `applyPostgresPermissionPolicies()`) that read the
|
|
96
|
+
session-injected `smrt.permissions` / `smrt.tenant_id` (set by `withSessionPermissionContext`
|
|
97
|
+
via `set_config`). Because the RLS teeth are at the data layer, enforcement is door-agnostic
|
|
98
|
+
— REST, MCP, and in-process callers are all bounded once the principal's context is set.
|
|
99
|
+
Setup: README → *Manifest-derived permission catalog* and *Postgres RLS enforcement*.
|
|
100
|
+
|
|
91
101
|
- Use `assertOperationPermission()` for hand-written mutations in SvelteKit form
|
|
92
102
|
actions, custom endpoints, CLI scripts, and jobs. It derives the same
|
|
93
103
|
`<collection>.<action>` slugs as `PermissionCatalogService` (`list`/`get` →
|
|
@@ -180,6 +190,9 @@ the package root).
|
|
|
180
190
|
- **Hooks**: `resolveUser` (invite-gating; default provisions via
|
|
181
191
|
`getOrCreateFromOidc`), `resolveTenantId`, `buildExtras` (bootstrap
|
|
182
192
|
`extras`; model JSON must use `toPublicJSON({ permissions })` — #1822).
|
|
193
|
+
`buildExtras` is the only app-domain bootstrap extension point. Never emit
|
|
194
|
+
app fields such as `dashboard` at the response top level: they are outside
|
|
195
|
+
`MobileSessionBootstrap` and the Kotlin decoder ignores them.
|
|
183
196
|
- **Guard** wraps `withSessionPermissionContext`, so
|
|
184
197
|
`assertOperationPermission`, tenancy context, and Postgres RLS all see the
|
|
185
198
|
bearer caller; `OperationPermissionError` maps to 403 with a
|
package/README.md
CHANGED
|
@@ -495,8 +495,17 @@ TenantService supports three modes: `flexible` (no auto-create), `personal` (aut
|
|
|
495
495
|
| `switchSessionTenant` | Change tenant context for current session |
|
|
496
496
|
| `beginOidcLogin`, `completeOidcLogin` | Low-level SvelteKit helpers for custom OIDC login routes |
|
|
497
497
|
| `createOidcLoginHandler`, `createOidcCallbackHandler` | Ready-to-use SvelteKit route handlers for OIDC login and callback |
|
|
498
|
+
| `createMobileAuthHandlers` | Mountable `/api/mobile` PKCE, bearer session, bootstrap, logout, and route-guard handlers |
|
|
499
|
+
| `resolveMobileUploadDedupKey` | Resolves `clientCaptureId` with `Idempotency-Key` fallback for app-owned multipart routes |
|
|
498
500
|
| `SessionLocals` | Type for `event.locals` (extend in `app.d.ts`) |
|
|
499
501
|
|
|
502
|
+
`createMobileAuthHandlers({ buildExtras })` places app-domain bootstrap data
|
|
503
|
+
under `MobileSessionBootstrap.extras`. Do not add app fields at the response
|
|
504
|
+
top level: they are outside the shared contract and the Kotlin client ignores
|
|
505
|
+
unknown top-level keys. Multipart ingestion remains app-owned; follow
|
|
506
|
+
[`mobile-upload-contract.md`](../../docs/content/architecture/mobile-upload-contract.md)
|
|
507
|
+
for authentication, deduplication, and status semantics.
|
|
508
|
+
|
|
500
509
|
### Types & Constants
|
|
501
510
|
|
|
502
511
|
| Export | Description |
|