Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Permix v4 is a major release that rewrites the core permission engine, simplifies the type definition model, and expands first-class integrations for modern full-stack TypeScript apps. This PR bumps the package from
3.8.1→4.0.0-rc.1(~316 files changed).Core API redesign
The permission definition model is now action-list based instead of entity config objects. Permissions are declared as tuples of action names (or action specs with per-action types):
check()now uses dot-path syntax instead of separate entity/action arguments:New
check()capabilities:'~any'/'~all'tokens (e.g.permix.check('post.~all'))permix.check(c => c('post.read') && c('post.edit'))createPermix(rules)for immediate readiness$inferPath— derive permission-path union types from an instance without restating the definitionThe core is split into focused modules (
check,rules,hooks,template,errors) with clearer error types (PermixNotReadyError,PermixRuleNotDefinedError, etc.).UI integrations (React, Vue, Solid, Svelte)
<Check>components now take a singlepathprop instead ofentity+actionfalsewhen not readyPermixHydrate+dehydrate()— note thathydrate()alone no longer marks the instance ready; you must callsetup()on the client to restore function-based rulespermix/svelte— Svelte 5 runes-based integration (PermixProvider,usePermix,Check,PermixHydrate)New integration packages
permix/nextcache()— setup in layout, dehydrate to clientpermix/tanstack-startpermix/server(req, next) => Response) — compatible with srvx and any web-standard serverpermix/drizzlepermix/drizzle/legacy>=0.30 <1)permix/effectLayer/Contextintegration for server and client programspermix/better-authroleToRules()converts roles to rulespermix/svelteUpdated integrations
tRPC, oRPC, Express, Hono, Node, Elysia, and Fastify middleware are unified around the new dot-path
check()API,setupMiddleware/checkMiddlewarepatterns, and configurableonForbiddenhandlers.Documentation site
The docs are migrated from Next.js → TanStack Start + Vite + Fumadocs. New/expanded guides:
Preview: https://permix-git-v4-valerii-strilets-projects.vercel.app
Examples
examples/next,examples/nextjs-better-auth(Drizzle + Better Auth),examples/tanstack-start,examples/rebac,examples/svelteCursor skills
New
skills/directory with agent skills for app developers: getting started, check patterns, frontend, server middleware, and SSR/hydration.Tooling & infra
10→11, TypeScript6, Vitest4Migration guide (v3 → v4)
1. Update permission definitions
2. Update
check()calls3. Update UI components
4. Update hydration flow
After
permix.hydrate(serverState), callpermix.setup(clientRules)on the client if you rely on function-based rules. Gate UI onisReady/isReadyAsync()as before.5. Update integration imports
Integration middleware APIs are largely the same shape but use dot-path checks internally. Review the updated docs for tRPC/oRPC context key configuration (
contextKey()) and the newpermix/serveralternative to Node-specific middleware.