-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support for edge runtime #1209
Conversation
WalkthroughWalkthroughThe recent updates involve enhancing the system's password handling, logging, and object formatting functionalities. Specifically, password hashing now utilizes a synchronous approach for improved consistency. Logging enhancements include replacing direct console warnings with a more structured Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review Status
Configuration used: CodeRabbit UI
Files ignored due to path filters (9)
packages/plugins/trpc/tests/projects/t3-trpc-v10/package.json
is excluded by!**/*.json
packages/plugins/trpc/tests/projects/t3-trpc-v10/src/server/api/routers/generated/client/next.ts
is excluded by!**/generated/**
packages/plugins/trpc/tests/projects/t3-trpc-v10/src/server/api/routers/generated/client/utils.ts
is excluded by!**/generated/**
packages/plugins/trpc/tests/projects/t3-trpc-v10/src/server/api/routers/generated/helper.ts
is excluded by!**/generated/**
packages/plugins/trpc/tests/projects/t3-trpc-v10/src/server/api/routers/generated/routers/Post.router.ts
is excluded by!**/generated/**
packages/plugins/trpc/tests/projects/t3-trpc-v10/src/server/api/routers/generated/routers/User.router.ts
is excluded by!**/generated/**
packages/plugins/trpc/tests/projects/t3-trpc-v10/src/server/api/routers/generated/routers/index.ts
is excluded by!**/generated/**
packages/runtime/package.json
is excluded by!**/*.json
pnpm-lock.yaml
is excluded by!pnpm-lock.yaml
,!**/*.yaml
Files selected for processing (16)
- packages/runtime/res/model-meta.d.ts (1 hunks)
- packages/runtime/res/model-meta.js (1 hunks)
- packages/runtime/src/enhancements/create-enhancement.ts (2 hunks)
- packages/runtime/src/enhancements/logger.ts (1 hunks)
- packages/runtime/src/enhancements/password.ts (2 hunks)
- packages/schema/src/plugins/plugin-utils.ts (2 hunks)
- packages/server/src/api/base.ts (1 hunks)
- packages/server/src/shared.ts (2 hunks)
- packages/server/src/types.ts (2 hunks)
- packages/server/tests/adapter/express.test.ts (3 hunks)
- packages/server/tests/adapter/fastify.test.ts (2 hunks)
- packages/server/tests/adapter/next.test.ts (2 hunks)
- packages/server/tests/adapter/sveltekit.test.ts (2 hunks)
- tests/integration/tests/cli/generate.test.ts (4 hunks)
- tests/integration/tests/enhancements/with-omit/with-omit.test.ts (1 hunks)
- tests/integration/tests/enhancements/with-policy/options.test.ts (1 hunks)
Additional Context Used
Additional comments not posted (22)
packages/server/src/shared.ts (3)
1-17
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [2-20]
The updates to the
loadAssets
function, including the use of default values and error handling for Zod schemas, are well-implemented.
29-37
: The implementation ofgetDefaultModelMeta
with direct module requiring and clear error handling is appropriate.
26-49
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [43-51]
While gracefully handling the absence of Zod schemas by returning
undefined
, consider logging the error or providing a more informative message to the user in case of failure to load the schemas.packages/server/src/types.ts (1)
36-44
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [39-57]
The updates to the
AdapterBaseOptions
interface, including clearer comments and the removal of theloadPath
option, are well-considered and improve the interface's usability.packages/server/src/api/base.ts (1)
62-62
: The simplification in theAPIHandlerBase
constructor by directly callinggetDefaultModelMeta()
without unnecessary arguments improves code readability.tests/integration/tests/enhancements/with-policy/options.test.ts (1)
19-19
: The simplification of the test setup by removing theloadPath
option from theenhance
function call aligns well with the broader changes in the PR.packages/runtime/src/enhancements/logger.ts (1)
16-24
: The updates to theLogger
class, including the logic to handle different runtime environments, are well-implemented and ensure compatibility across platforms.packages/runtime/src/enhancements/password.ts (1)
56-56
: The switch tohashSync
for password hashing in thePasswordHandler
class is a positive change, ensuring synchronous operations and simplifying control flow.packages/schema/src/plugins/plugin-utils.ts (2)
31-34
: Consider usingfs-extra
for operations like removing directories, as it provides a more powerful and user-friendly API than the nativefs
module. This can simplify the code and improve readability.
71-74
: Creating emptyindex.js
files in the specified subfolders is a good practice for maintaining the structure of the output directory. However, ensure that these files are indeed necessary for your project's functionality or build process.tests/integration/tests/enhancements/with-omit/with-omit.test.ts (1)
86-86
: Removing theloadPath
parameter simplifies theenhance
function call. Ensure that this change aligns with the updated project structure and functionalities, and that all necessary configurations are still correctly applied.packages/runtime/src/enhancements/create-enhancement.ts (2)
7-7
: The addition of theLogger
import is a good practice for consistent logging across the application. Ensure that theLogger
class is implemented with appropriate log levels and output destinations to suit the application's needs.
154-156
: Replacingconsole.warn
withLogger.warn
enhances the logging mechanism by providing more control over log output. This change aligns with best practices for application logging.tests/integration/tests/cli/generate.test.ts (1)
149-150
: The new assertion to check for the presence of a specific module after generating files is a good practice. It ensures that the generation process completes successfully and the expected output is produced.packages/server/tests/adapter/sveltekit.test.ts (2)
6-6
: Adding thepath
import is necessary for file path operations, especially when dealing with dynamic paths. This is a good practice for ensuring portability and correctness of file paths across different operating systems.
85-91
: The modifications in thecustom load path
test to includeprojectDir
and update theSvelteKitHandler
call with new properties likemodelMeta
andzodSchemas
are crucial for ensuring the test reflects the updated project structure and functionalities.packages/server/tests/adapter/fastify.test.ts (2)
7-7
: The use ofpath
for file path operations is a good practice, ensuring the correct handling of file paths across different environments.
118-125
: The modifications to includeprojectDir
in theloadSchema
call and update the arguments passed toZenStackFastifyPlugin
are important for ensuring the tests accurately reflect the updated project structure and functionalities.packages/server/tests/adapter/express.test.ts (2)
12-12
: The addition of thepath
import is necessary for handling file paths, especially when dealing with dynamic paths in tests. This ensures compatibility across different operating systems.
91-102
: The modifications in thecustom load path
test to includeprojectDir
and update theZenStackMiddleware
parameters are crucial for ensuring the test reflects the updated project structure and functionalities.packages/server/tests/adapter/next.test.ts (2)
6-6
: The addition of thepath
import is a good practice for handling file paths, ensuring compatibility and correctness across different environments.
175-181
: The modifications to includeprojectDir
in theloadSchema
call and update the arguments passed tomakeTestClient
are important for ensuring the tests accurately reflect the updated project structure and functionalities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/runtime/res/model-meta.d.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/runtime/res/model-meta.d.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/runtime/src/enhancements/logger.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/runtime/src/enhancements/logger.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/runtime/src/enhancements/password.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/runtime/src/enhancements/password.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/runtime/src/enhancements/password.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/runtime/src/enhancements/password.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (2)
- packages/runtime/src/enhancements/create-enhancement.ts (3 hunks)
- packages/runtime/src/enhancements/utils.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/runtime/src/enhancements/create-enhancement.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (3)
- packages/runtime/src/enhancements/delegate.ts (1 hunks)
- packages/runtime/src/enhancements/policy/handler.ts (1 hunks)
- packages/runtime/src/enhancements/policy/policy-utils.ts (3 hunks)
Additional comments not posted (3)
packages/runtime/src/enhancements/delegate.ts (1)
660-664
: Consider adding documentation or comments explaining thelogPrismaQuery
option.
This will help developers understand its purpose and how to use it effectively.packages/runtime/src/enhancements/policy/handler.ts (2)
715-715
: Ensure that theshouldLogQuery
property is correctly implemented and used consistently throughout the class for logging conditions.
712-718
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-715]
Review the entire
PolicyProxyHandler
class for potential improvements in error handling, code duplication, performance considerations, and adherence to best practices. Given the complexity, ensure that the class is well-documented, especially for public methods and complex logic.
Fixes #785 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
packages/runtime/package.json
is excluded by!**/*.json
pnpm-lock.yaml
is excluded by!pnpm-lock.yaml
,!**/*.yaml
Files selected for processing (4)
- packages/runtime/src/enhancements/password.ts (3 hunks)
- packages/runtime/src/enhancements/policy/policy-utils.ts (4 hunks)
- packages/runtime/src/enhancements/utils.ts (1 hunks)
- packages/schema/src/plugins/plugin-utils.ts (2 hunks)
Files skipped from review as they are similar to previous changes (4)
- packages/runtime/src/enhancements/password.ts
- packages/runtime/src/enhancements/policy/policy-utils.ts
- packages/runtime/src/enhancements/utils.ts
- packages/schema/src/plugins/plugin-utils.ts
Summary by CodeRabbit