Improvements and fixes#3
Closed
gjovanovicst wants to merge 2 commits into
Closed
Conversation
* Implement integration tests for various SDK functionalities * Include tests for user, tenant, role, and resource management * Ensure proper cleanup of test data after execution * Add Jest configuration for TypeScript support
- Revise changelog to include detailed features for version 1.0.0-alpha.1 - Enhance README with clearer usage examples and configuration details - Add new methods and APIs for user, role, and resource management - Improve clarity on permission checks and error handling
There was a problem hiding this comment.
Pull request overview
This PR updates the SDK to better align with backend payload/response shapes (notably resource actions and role assignment deletion), adds Jest-based integration testing scaffolding, and refreshes documentation/changelog to reflect current SDK usage.
Changes:
- Update resource types to support backend-style action maps and add legacy/snake_case field aliases.
- Change role-assignment unassign to send a JSON body and extend
httpDeleteto accept an optional body. - Add Jest config and a new end-to-end integration test suite; update README and CHANGELOG accordingly.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/resource.ts | Adjusts resource typings (actions map + timestamp/pagination aliases) to match backend formats. |
| src/types/index.ts | Removes IResource export from the types barrel. |
| src/index.ts | Removes IResource export from package-level type exports. |
| src/api/role-assignments.ts | Switches unassign to DELETE-with-body semantics. |
| src/api/resources.ts | Normalizes actions from string[] to backend map format on create/update/sync. |
| src/api/base.ts | Extends httpDelete to accept an optional JSON body (axios data). |
| src/tests/integration.test.ts | Adds integration tests that exercise major SDK flows end-to-end. |
| jest.config.js | Introduces Jest + ts-jest configuration for running TS tests. |
| README.md | Updates docs/examples to match current SDK behavior and features. |
| CHANGELOG.md | Rewrites changelog entries and adds an alpha release entry. |
Comments suppressed due to low confidence (2)
src/types/index.ts:33
- Removing the exported
IResourcetype is a breaking change for SDK consumers. If this is intentional, consider keeping an alias/deprecated export for one release cycle and/or documenting the migration (and exportingIResourceActionsince it is now part of the public resource type surface).
// Resource types
export type {
IResourceCreate,
IResourceUpdate,
IResourceRead,
IResourceList,
src/index.ts:84
- Package-level exports also drop
IResource, which is a breaking API change for downstream TypeScript users. If the intent is to replace it, consider exporting a backwards-compatible alias and/or explicitly exportingIResourceActionso consumers can type the new actions map format.
IRoleRead,
IRoleList,
// Resource types
IResourceCreate,
IResourceUpdate,
IResourceRead,
IResourceList,
IResourceInstance,
IResourceInstanceCreate,
IResourceInstanceRead,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+15
to
+18
| const DEFAULT_ENV_KEY = | ||
| "permis_key_d39064912cd9d1f0052a98430e3eb7d689a350d84f2d0a018843541b5da3e5ef"; | ||
| const API_KEY = process.env.PERMIS_API_KEY ?? DEFAULT_ENV_KEY; | ||
| const API_URL = process.env.PERMIS_API_URL ?? "http://localhost:3001"; |
Comment on lines
+27
to
+30
| // Always run — we have a fallback key embedded above | ||
| const itIntegration = it; | ||
|
|
||
| describe("Permissio Node.js SDK — Integration", () => { |
| user: assignment.user, | ||
| role: assignment.role, | ||
| tenant: assignment.tenant, | ||
| resource_instance: assignment.resourceInstance, |
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.
No description provided.