Add main Permissio SDK client and permission checks#1
Conversation
- Implement main Permissio SDK client with methods for checking permissions, managing users, and assigning roles. - Introduce types for permission checks, user roles, and resources. - Add bulk permission checking and user synchronization functionalities. - Ensure scope initialization for API key management. - Include debug logging for better traceability during permission evaluations.
There was a problem hiding this comment.
Pull request overview
This PR updates the branding from "Permis.io" to "Permissio.io" across the entire codebase, including renaming the main SDK class, interfaces, error classes, and updating all documentation and examples. The changes affect SDK initialization, API clients, configuration, examples, and supporting documentation.
Key Changes:
- Renamed main SDK class from
PermistoPermissio - Updated all interface names (e.g.,
IPermisConfig→IPermissioConfig) - Renamed error class from
PermisApiErrortoPermissioApiError - Updated API URL defaults from
api.permis.iotoapi.permissio.io - Updated all documentation, examples, and package metadata
Reviewed changes
Copilot reviewed 14 out of 30 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/permissio.ts | Renamed main SDK class and updated documentation; contains typo in example code |
| src/index.ts | Updated exports and package documentation with new branding; example code has inconsistent variable names |
| src/config/index.ts | Renamed configuration interfaces and updated API URL default |
| src/api/base.ts | Renamed error class and updated logger messages |
| src/api/index.ts | Updated error class export |
| package.json | Updated package metadata with new branding |
| README.md | Comprehensive documentation updates; contains inconsistent variable and type names in examples |
| examples/browser-demo/* | Updated demo application with new SDK naming |
| LICENSE, CONTRIBUTING.md, CHANGELOG.md | Updated branding references |
Files not reviewed (1)
- examples/browser-demo/package-lock.json: Language not supported
Comments suppressed due to low confidence (4)
src/permissio.ts:435
- Inconsistent variable naming. The variable
permisshould be renamed topermissiothroughout all example code blocks in this documentation to match the new SDK class namePermissio.
src/permissio.ts:42 - Typo in the example code:
new Permissiosioshould benew Permissio(extra "sio" in the middle).
src/permissio.ts:49 - Inconsistent variable naming in examples. The variable name is
permis(old naming convention) but should bepermissioto match the new class namePermissioand maintain consistency throughout the documentation.
src/permissio.ts:68 - Inconsistent variable naming in examples. Multiple instances use
permisinstead ofpermissio. All example code should usepermissioto match the new SDK class name.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * const allowed = await permis.check({ | ||
| * user: 'user@example.com', | ||
| * action: 'read', | ||
| * resource: 'document', | ||
| * }); | ||
| * | ||
| * if (allowed) { | ||
| * console.log('Access granted!'); | ||
| * } else { | ||
| * console.log('Access denied!'); | ||
| * } | ||
| * ``` |
There was a problem hiding this comment.
Inconsistent variable naming. Example code uses permis but should use permissio to match the new SDK branding.
| Permis, | ||
| IPermisConfig, | ||
| ICheckRequest, | ||
| ICheckResponse, | ||
| IUserCreate, | ||
| IUserRead, | ||
| IRoleAssignmentCreate, | ||
| } from 'permissio'; | ||
|
|
||
| const config: IPermisConfig = { |
There was a problem hiding this comment.
Inconsistent type name reference. The example imports IPermisConfig which should be IPermissioConfig to match the renamed interface.
| const config: IPermisConfig = { | ||
| token: 'permis_key_...', | ||
| projectId: 'my-project', | ||
| environmentId: 'production', | ||
| }; |
There was a problem hiding this comment.
Inconsistent interface name. The type IPermisConfig should be renamed to IPermissioConfig to match the new SDK branding. The variable assignment also uses the old type name.
| export class PermisGuard implements CanActivate { | ||
| constructor( | ||
| private reflector: Reflector, | ||
| private permis: Permis |
There was a problem hiding this comment.
Inconsistent variable name. The example uses permis and the old interface reference Permis, but should use permissio and Permissio to match the new SDK branding.
| export class PermisGuard implements CanActivate { | |
| constructor( | |
| private reflector: Reflector, | |
| private permis: Permis | |
| export class PermissioGuard implements CanActivate { | |
| constructor( | |
| private reflector: Reflector, | |
| private permissio: Permissio |
Implement the main Permissio SDK client with functionalities for permission checks, user management, and role assignments. Introduce types for permissions and users, along with bulk checking and synchronization features. Enhance API key management and add debug logging for improved traceability. Update references from "Permis.io" to "Permissio.io" throughout the documentation and codebase.